summaryrefslogtreecommitdiff
path: root/utility/rtos_compatibility_layers/posix
diff options
context:
space:
mode:
Diffstat (limited to 'utility/rtos_compatibility_layers/posix')
-rw-r--r--utility/rtos_compatibility_layers/posix/errno.h16
-rw-r--r--utility/rtos_compatibility_layers/posix/fcntl.h62
-rw-r--r--utility/rtos_compatibility_layers/posix/posix_demo.c44
-rw-r--r--utility/rtos_compatibility_layers/posix/posix_signal_nested_test.c30
-rw-r--r--utility/rtos_compatibility_layers/posix/posix_signal_resume_thread_test.c48
-rw-r--r--utility/rtos_compatibility_layers/posix/posix_signal_self_send_test.c54
-rw-r--r--utility/rtos_compatibility_layers/posix/posix_signal_sigmask_test.c84
-rw-r--r--utility/rtos_compatibility_layers/posix/posix_signal_sigwait_test.c58
-rw-r--r--utility/rtos_compatibility_layers/posix/posix_signal_suspended_thread_test.c44
-rw-r--r--utility/rtos_compatibility_layers/posix/pthread.h14
-rw-r--r--utility/rtos_compatibility_layers/posix/px_abs_time_to_rel_ticks.c19
-rw-r--r--utility/rtos_compatibility_layers/posix/px_clock_getres.c51
-rw-r--r--utility/rtos_compatibility_layers/posix/px_clock_gettime.c53
-rw-r--r--utility/rtos_compatibility_layers/posix/px_clock_settime.c49
-rw-r--r--utility/rtos_compatibility_layers/posix/px_cond_broadcast.c57
-rw-r--r--utility/rtos_compatibility_layers/posix/px_cond_destroy.c53
-rw-r--r--utility/rtos_compatibility_layers/posix/px_cond_init.c53
-rw-r--r--utility/rtos_compatibility_layers/posix/px_cond_signal.c47
-rw-r--r--utility/rtos_compatibility_layers/posix/px_cond_timedwait.c63
-rw-r--r--utility/rtos_compatibility_layers/posix/px_cond_wait.c61
-rw-r--r--utility/rtos_compatibility_layers/posix/px_error.c73
-rw-r--r--utility/rtos_compatibility_layers/posix/px_in_thread_context.c23
-rw-r--r--utility/rtos_compatibility_layers/posix/px_int.h26
-rw-r--r--utility/rtos_compatibility_layers/posix/px_internal_signal_dispatch.c45
-rw-r--r--utility/rtos_compatibility_layers/posix/px_memory_allocate.c21
-rw-r--r--utility/rtos_compatibility_layers/posix/px_memory_release.c29
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mq_arrange_msg.c22
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mq_attr_init.c19
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mq_close.c27
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mq_create.c31
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mq_find_queue.c17
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mq_get_new_queue.c37
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mq_get_queue_desc.c17
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mq_open.c27
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mq_priority_search.c15
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mq_putback_queue.c17
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mq_queue_delete.c17
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mq_queue_init.c17
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mq_receive.c45
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mq_reset_queue.c17
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mq_send.c45
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mq_unlink.c17
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mx_attr_destroy.c63
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mx_attr_getprotocol.c57
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mx_attr_getpshared.c57
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mx_attr_gettype.c57
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mx_attr_initi.c59
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mx_attr_setprotocol.c61
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mx_attr_setpshared.c61
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mx_attr_settype.c61
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mx_destroy.c61
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mx_init.c75
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mx_lock.c61
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mx_set_default_mutexattr.c63
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mx_timedlock.c57
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mx_trylock.c63
-rw-r--r--utility/rtos_compatibility_layers/posix/px_mx_unlock.c61
-rw-r--r--utility/rtos_compatibility_layers/posix/px_nanosleep.c19
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_attr_destroy.c63
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_attr_getdetachstate.c65
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_attr_getinheritsched.c63
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_attr_getschedparam.c63
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_attr_getschedpolicy.c63
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_attr_getstack.c77
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_attr_getstackaddr.c63
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_attr_getstacksize.c63
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_attr_init.c59
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_attr_setdetachstate.c65
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_attr_setinheritsched.c61
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_attr_setschedparam.c63
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_attr_setschedpolicyl.c63
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_attr_setstack.c77
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_attr_setstackaddr.c63
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_attr_setstacksize.c59
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_cancel.c37
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_create.c100
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_detach.c25
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_equal.c21
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_exit.c37
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_getcanceltype.c77
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_getschedparam.c63
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_init.c1011
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_join.c35
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_kill.c86
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_once.c21
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_self.c39
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_set_default_pthread_attr.c63
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_setcancelstate.c73
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_setcanceltype.c77
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_setschedparam.c59
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_sigmask.c58
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_testcancel.c27
-rw-r--r--utility/rtos_compatibility_layers/posix/px_pth_yield.c49
-rw-r--r--utility/rtos_compatibility_layers/posix/px_px_initialize.c49
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sched_get_prio.c17
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sched_yield.c17
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sem_close.c17
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sem_destroy.c19
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sem_find_sem.c19
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sem_get_new_sem.c19
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sem_getvalue.c19
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sem_init.c19
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sem_open.c27
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sem_post.c17
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sem_reset.c17
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sem_set_sem_name.c17
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sem_trywait.c17
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sem_unlink.c21
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sem_wait.c17
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sig_addset.c21
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sig_delset.c21
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sig_emptyset.c19
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sig_fillset.c19
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sig_signal.c23
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sig_wait.c51
-rw-r--r--utility/rtos_compatibility_layers/posix/px_sleep.c49
-rw-r--r--utility/rtos_compatibility_layers/posix/px_system_manager.c67
-rw-r--r--utility/rtos_compatibility_layers/posix/readme_release_history.txt12
-rw-r--r--utility/rtos_compatibility_layers/posix/readme_threadx_posix.txt62
-rw-r--r--utility/rtos_compatibility_layers/posix/sched.h16
-rw-r--r--utility/rtos_compatibility_layers/posix/signal.h35
-rw-r--r--utility/rtos_compatibility_layers/posix/time.h18
-rw-r--r--utility/rtos_compatibility_layers/posix/tx_posix.h101
-rw-r--r--utility/rtos_compatibility_layers/posix/tx_px_time.h16
124 files changed, 2861 insertions, 3485 deletions
diff --git a/utility/rtos_compatibility_layers/posix/errno.h b/utility/rtos_compatibility_layers/posix/errno.h
index 65077d9a..2b01c34c 100644
--- a/utility/rtos_compatibility_layers/posix/errno.h
+++ b/utility/rtos_compatibility_layers/posix/errno.h
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -33,13 +34,6 @@
/* This file defines the constants, structures, etc.needed to */
/* implement the Evacuation Kit for POSIX Users (POSIX) */
/* */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
#ifndef _ERRNO_H
@@ -96,7 +90,7 @@
#define EDQUOT 213
-#define EEXIST 17
+#define EEXIST 17
#define EFAULT 214
diff --git a/utility/rtos_compatibility_layers/posix/fcntl.h b/utility/rtos_compatibility_layers/posix/fcntl.h
index 8c362bec..db943625 100644
--- a/utility/rtos_compatibility_layers/posix/fcntl.h
+++ b/utility/rtos_compatibility_layers/posix/fcntl.h
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -33,13 +34,6 @@
/* This file defines the constants, structures, etc.needed to */
/* implement the Evacuation Kit for POSIX Users (POSIX) */
/* */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
#ifndef _FCNTL_H
@@ -52,39 +46,39 @@
#define O_APPEND 0x0008
#define O_SYNC 0x0010
#define O_NONBLOCK 0x0080
-#define O_CREAT 0x0100
-#define O_TRUNC 0x0200
-#define O_EXCL 0x0400
-#define O_NOCTTY 0x0800
-#define FASYNC 0x1000
-#define O_LARGEFILE 0x2000
-#define O_DIRECT 0x8000
-#define O_DIRECTORY 0x10000
-#define O_NOFOLLOW 0x20000
+#define O_CREAT 0x0100
+#define O_TRUNC 0x0200
+#define O_EXCL 0x0400
+#define O_NOCTTY 0x0800
+#define FASYNC 0x1000
+#define O_LARGEFILE 0x2000
+#define O_DIRECT 0x8000
+#define O_DIRECTORY 0x10000
+#define O_NOFOLLOW 0x20000
#define O_NDELAY O_NONBLOCK
-#define F_DUPFD 0
-#define F_GETFD 1
-#define F_SETFD 2
-#define F_GETFL 3
-#define F_SETFL 4
+#define F_DUPFD 0
+#define F_GETFD 1
+#define F_SETFD 2
+#define F_GETFL 3
+#define F_SETFL 4
#define F_GETLK 14
#define F_SETLK 6
#define F_SETLKW 7
-#define F_SETOWN 24
-#define F_GETOWN 23
-#define F_SETSIG 10
-#define F_GETSIG 11
+#define F_SETOWN 24
+#define F_GETOWN 23
+#define F_SETSIG 10
+#define F_GETSIG 11
-#define FD_CLOEXEC 1
+#define FD_CLOEXEC 1
-# define POSIX_FADV_NORMAL 0
-# define POSIX_FADV_RANDOM 1
-# define POSIX_FADV_SEQUENTIAL 2
-# define POSIX_FADV_WILLNEED 3
-# define POSIX_FADV_DONTNEED 4
+# define POSIX_FADV_NORMAL 0
+# define POSIX_FADV_RANDOM 1
+# define POSIX_FADV_SEQUENTIAL 2
+# define POSIX_FADV_WILLNEED 3
+# define POSIX_FADV_DONTNEED 4
# define POSIX_FADV_NOREUSE 5
/* no flock structure for Threadx at this time */
diff --git a/utility/rtos_compatibility_layers/posix/posix_demo.c b/utility/rtos_compatibility_layers/posix/posix_demo.c
index 339ad9bb..7adeb9c3 100644
--- a/utility/rtos_compatibility_layers/posix/posix_demo.c
+++ b/utility/rtos_compatibility_layers/posix/posix_demo.c
@@ -94,7 +94,7 @@ struct sched_param param;
queue_atrr.mq_maxmsg = 124;
queue_atrr.mq_msgsize = MAX_MESSAGE_SIZE;
-
+
/* Init POSIX Wrapper */
storage_ptr = (VOID*) posix_initialize(free_memory);
@@ -107,54 +107,54 @@ struct sched_param param;
pthread_attr_init(&ptattr2);
pthread_attr_init(&ptattr3);
pthread_attr_init(&ptattr4);
- pthread_attr_init(&ptattr5);
+ pthread_attr_init(&ptattr5);
/* Create a sched_param structure */
memset(&param, 0, sizeof(param));
-
+
/* Now create all pthreads , firstly modify respective ptheread
attribute with desired priority and stack start address and then create the pthread */
-
+
/* Create pthread 0. */
param.sched_priority = 10;
pthread_attr_setschedparam(&ptattr0, &param);
pthread_attr_setstackaddr(&ptattr0, storage_ptr );
- storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_0, &ptattr0,pthread_0_entry,NULL);
-
+
/* Create pthread 1. */
param.sched_priority = 15;
pthread_attr_setschedparam(&ptattr1, &param);
pthread_attr_setstackaddr(&ptattr1, (VOID*) storage_ptr );
- storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_1, &ptattr1,pthread_1_entry,NULL);
-
+
/* Create pthread 2. */
param.sched_priority = 20;
pthread_attr_setschedparam(&ptattr2, &param);
pthread_attr_setstackaddr(&ptattr2, (VOID*) storage_ptr );
- storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_2, &ptattr2,pthread_2_entry,NULL);
/* Create pthread 3. */
param.sched_priority = 25;
pthread_attr_setschedparam(&ptattr3, &param);
pthread_attr_setstackaddr(&ptattr3, (VOID*) storage_ptr );
- storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_3, &ptattr3,pthread_3_entry,NULL);
-
+
/* Create pthread 4. */
param.sched_priority = 30;
pthread_attr_setschedparam(&ptattr4, &param);
pthread_attr_setstackaddr(&ptattr4, (VOID*) storage_ptr );
- storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_4, &ptattr4,pthread_4_entry,NULL);
-
+
/* Create pthread 5. */
param.sched_priority = 5;
pthread_attr_setschedparam(&ptattr5, &param);
pthread_attr_setstackaddr(&ptattr5, (VOID*) storage_ptr );
- storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_5, &ptattr5,pthread_5_entry,NULL);
/* Create a Message queue. */
@@ -165,7 +165,7 @@ struct sched_param param;
/* Create a Mutex */
pthread_mutex_init(&mutex1, NULL);
-
+
}
/* Define the test pthreads */
@@ -176,8 +176,8 @@ VOID *pthread_0_entry(VOID *pthread0_input)
struct timespec thread_0_sleep_time={0,0};
- /* This pthread simply sits in while-forever-sleep loop */
- while(1)
+ /* This pthread simply sits in while-forever-sleep loop */
+ while(1)
{
/* Increment the pthread counter.*/
pthread_0_counter++;
@@ -197,13 +197,13 @@ INT pt1_status=0;
VOID *pthread_1_entry(VOID *pthread1_input)
{
-
+
struct timespec thread_1_sleep_time={0,0};
/* This thread simply sends a messages to a queue shared by pthread 2. */
while(1)
{
-
+
/* Increment the thread counter. */
pthread_1_counter++;
/* Send message to queue 0. */
@@ -229,7 +229,7 @@ INT pt2_status;
VOID *pthread_2_entry(VOID *pthread2_input)
{
-CHAR msgr0[MAX_MESSAGE_SIZE];
+CHAR msgr0[MAX_MESSAGE_SIZE];
ULONG priority;
struct timespec thread_2_sleep_time={0,0};
@@ -239,7 +239,7 @@ struct timespec thread_2_sleep_time={0,0};
/* Increment the thread counter. */
pthread_2_counter++;
pt2_status = mq_receive(q_des,msgr0,MAX_MESSAGE_SIZE,&priority);
-
+
if(pt2_status == ERROR)
break;
@@ -266,7 +266,7 @@ struct timespec thread_3_sleep_time={0,0};
/* Increment the thread counter. */
pthread_3_counter++;
- /* Get the semaphore with suspension. */
+ /* Get the semaphore with suspension. */
pt3_status = sem_wait(sem);
/* Check status. */
diff --git a/utility/rtos_compatibility_layers/posix/posix_signal_nested_test.c b/utility/rtos_compatibility_layers/posix/posix_signal_nested_test.c
index 70fb4887..6f5b6478 100644
--- a/utility/rtos_compatibility_layers/posix/posix_signal_nested_test.c
+++ b/utility/rtos_compatibility_layers/posix/posix_signal_nested_test.c
@@ -56,7 +56,7 @@ VOID tx_application_define(VOID *first_unused_memory)
struct sched_param param;
-
+
/* Init POSIX Wrapper */
storage_ptr = (VOID*) posix_initialize((VOID* )free_memory);
@@ -68,15 +68,15 @@ struct sched_param param;
/* Create a sched_param structure */
memset(&param, 0, sizeof(param));
-
+
/* Now create all pthreads , firstly modify respective ptheread
attribute with desired priority and stack start address and then create the pthread */
-
+
/* Create pthread 0. */
param.sched_priority = 10;
pthread_attr_setschedparam(&ptattr0, &param);
pthread_attr_setstackaddr(&ptattr0, storage_ptr );
- storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_0, &ptattr0,pthread_0_entry,NULL);
}
@@ -100,7 +100,7 @@ VOID pthread_0_signal_handler13(int signo)
called from pthread 0. */
if (pthread_self() != pthread_0)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -108,7 +108,7 @@ VOID pthread_0_signal_handler13(int signo)
/* Check for proper signal. */
if (signo != 13)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -125,7 +125,7 @@ VOID pthread_0_signal_handler14(int signo)
called from pthread 0. */
if (pthread_self() != pthread_0)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -133,7 +133,7 @@ VOID pthread_0_signal_handler14(int signo)
/* Check for proper signal. */
if (signo != 14)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -153,7 +153,7 @@ VOID pthread_0_signal_handler15(int signo)
called from pthread 0. */
if (pthread_self() != pthread_0)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -161,7 +161,7 @@ VOID pthread_0_signal_handler15(int signo)
/* Check for proper signal. */
if (signo != 15)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -202,18 +202,18 @@ VOID *pthread_0_entry(VOID *pthread0_input)
if (pt0_status)
error_handler();
- /* This pthread simply sits in while-forever-sleep loop */
- while(1)
+ /* This pthread simply sits in while-forever-sleep loop */
+ while(1)
{
/* Increment the pthread counter.*/
pthread_0_counter++;
/* Raise the signal. */
pt0_status = pthread_kill(pthread_0, 15);
-
+
/* Check for errors. */
- if ((pt0_status) ||
- (pthread_0_counter != pthread_0_signal_counter15) ||
+ if ((pt0_status) ||
+ (pthread_0_counter != pthread_0_signal_counter15) ||
(pthread_0_counter != pthread_0_signal_counter14) ||
(pthread_0_counter != pthread_0_signal_counter13))
{
diff --git a/utility/rtos_compatibility_layers/posix/posix_signal_resume_thread_test.c b/utility/rtos_compatibility_layers/posix/posix_signal_resume_thread_test.c
index d2548056..90878158 100644
--- a/utility/rtos_compatibility_layers/posix/posix_signal_resume_thread_test.c
+++ b/utility/rtos_compatibility_layers/posix/posix_signal_resume_thread_test.c
@@ -66,7 +66,7 @@ VOID tx_application_define(VOID *first_unused_memory)
struct sched_param param;
-
+
/* Init POSIX Wrapper */
storage_ptr = (VOID*) posix_initialize((VOID*)free_memory);
@@ -79,15 +79,15 @@ struct sched_param param;
/* Create a sched_param structure */
memset(&param, 0, sizeof(param));
-
+
/* Now create all pthreads , firstly modify respective ptheread
attribute with desired priority and stack start address and then create the pthread */
-
+
/* Create pthread 0. */
param.sched_priority = 15;
pthread_attr_setschedparam(&ptattr0, &param);
pthread_attr_setstackaddr(&ptattr0, storage_ptr );
- storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_0, &ptattr0,pthread_0_entry,NULL);
@@ -95,7 +95,7 @@ struct sched_param param;
param.sched_priority = 10;
pthread_attr_setschedparam(&ptattr1, &param);
pthread_attr_setstackaddr(&ptattr1, (VOID*) storage_ptr );
- storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_1, &ptattr1,pthread_1_entry,NULL);
@@ -124,7 +124,7 @@ VOID pthread_0_signal_handler13(int signo)
called from pthread 0. */
if (pthread_self() != pthread_0)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -132,7 +132,7 @@ VOID pthread_0_signal_handler13(int signo)
/* Check for proper signal. */
if (signo != 13)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -152,7 +152,7 @@ VOID pthread_0_signal_handler14(int signo)
called from pthread 0. */
if (pthread_self() != pthread_0)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -160,7 +160,7 @@ VOID pthread_0_signal_handler14(int signo)
/* Check for proper signal. */
if (signo != 14)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -180,7 +180,7 @@ VOID pthread_0_signal_handler15(int signo)
called from pthread 0. */
if (pthread_self() != pthread_0)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -188,7 +188,7 @@ VOID pthread_0_signal_handler15(int signo)
/* Check for proper signal. */
if (signo != 15)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -230,30 +230,30 @@ VOID *pthread_0_entry(VOID *pthread0_input)
error_handler();
- /* Get the semaphore with suspension. */
+ /* Get the semaphore with suspension. */
pt0_status = sem_wait(sem);
- /* This pthread simply sits in while-forever-sleep loop */
- while(1)
+ /* This pthread simply sits in while-forever-sleep loop */
+ while(1)
{
/* Increment the pthread counter.*/
pthread_0_counter++;
- /* Get the semaphore with suspension. */
+ /* Get the semaphore with suspension. */
pt0_status = sem_wait(sem);
/* Check for errors. */
- if ((pt0_status) ||
- (pthread_0_counter != pthread_0_signal_counter15) ||
+ if ((pt0_status) ||
+ (pthread_0_counter != pthread_0_signal_counter15) ||
(pthread_0_counter != pthread_0_signal_counter14) ||
(pthread_0_counter != pthread_0_signal_counter13))
{
-
+
/* In this test, this thread should never resume! */
error_handler();
/* Break out of the loop. */
- break;
+ break;
}
}
@@ -265,12 +265,12 @@ INT pt1_status=0;
VOID *pthread_1_entry(VOID *pthread1_input)
{
-
+
/* This thread simply sends a messages to a queue shared by pthread 2. */
while(1)
{
-
+
/* Increment the thread counter. */
pthread_1_counter++;
@@ -278,9 +278,9 @@ VOID *pthread_1_entry(VOID *pthread1_input)
pt1_status = pthread_kill(pthread_0, 15);
/* Check for errors. */
- if ((pt1_status) ||
+ if ((pt1_status) ||
(pthread_0_counter != (pthread_1_counter+1)) ||
- (pthread_1_counter != pthread_0_signal_counter15) ||
+ (pthread_1_counter != pthread_0_signal_counter15) ||
(pthread_1_counter != pthread_0_signal_counter14) ||
(pthread_1_counter != pthread_0_signal_counter13))
{
@@ -289,7 +289,7 @@ VOID *pthread_1_entry(VOID *pthread1_input)
break;
}
}
-
+
return(&pt1_status);
}
diff --git a/utility/rtos_compatibility_layers/posix/posix_signal_self_send_test.c b/utility/rtos_compatibility_layers/posix/posix_signal_self_send_test.c
index 24e86b95..bbeb419f 100644
--- a/utility/rtos_compatibility_layers/posix/posix_signal_self_send_test.c
+++ b/utility/rtos_compatibility_layers/posix/posix_signal_self_send_test.c
@@ -116,7 +116,7 @@ struct sched_param param;
queue_atrr.mq_maxmsg = 124;
queue_atrr.mq_msgsize = MAX_MESSAGE_SIZE;
#endif
-
+
/* Init POSIX Wrapper */
storage_ptr = (VOID*) posix_initialize((VOID*)free_memory);
@@ -130,56 +130,56 @@ queue_atrr.mq_msgsize = MAX_MESSAGE_SIZE;
pthread_attr_init(&ptattr2);
pthread_attr_init(&ptattr3);
pthread_attr_init(&ptattr4);
- pthread_attr_init(&ptattr5);
+ pthread_attr_init(&ptattr5);
#endif
/* Create a sched_param structure */
memset(&param, 0, sizeof(param));
-
+
/* Now create all pthreads , firstly modify respective ptheread
attribute with desired priority and stack start address and then create the pthread */
-
+
/* Create pthread 0. */
param.sched_priority = 10;
pthread_attr_setschedparam(&ptattr0, &param);
pthread_attr_setstackaddr(&ptattr0, storage_ptr );
- storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = (int *) storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_0, &ptattr0,pthread_0_entry,NULL);
-
+
#if 0
/* Create pthread 1. */
param.sched_priority = 15;
pthread_attr_setschedparam(&ptattr1, &param);
pthread_attr_setstackaddr(&ptattr1, (VOID*) storage_ptr );
- storage_ptr = storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_1, &ptattr1,pthread_1_entry,NULL);
-
+
/* Create pthread 2. */
param.sched_priority = 20;
pthread_attr_setschedparam(&ptattr2, &param);
pthread_attr_setstackaddr(&ptattr2, (VOID*) storage_ptr );
- storage_ptr = storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_2, &ptattr2,pthread_2_entry,NULL);
/* Create pthread 3. */
param.sched_priority = 25;
pthread_attr_setschedparam(&ptattr3, &param);
pthread_attr_setstackaddr(&ptattr3, (VOID*) storage_ptr );
- storage_ptr = storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_3, &ptattr3,pthread_3_entry,NULL);
-
+
/* Create pthread 4. */
param.sched_priority = 30;
pthread_attr_setschedparam(&ptattr4, &param);
pthread_attr_setstackaddr(&ptattr4, (VOID*) storage_ptr );
- storage_ptr = storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_4, &ptattr4,pthread_4_entry,NULL);
-
+
/* Create pthread 5. */
param.sched_priority = 5;
pthread_attr_setschedparam(&ptattr5, &param);
pthread_attr_setstackaddr(&ptattr5, (VOID*) storage_ptr );
- storage_ptr = storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_5, &ptattr5,pthread_5_entry,NULL);
/* Create a Message queue. */
@@ -191,7 +191,7 @@ queue_atrr.mq_msgsize = MAX_MESSAGE_SIZE;
/* Create a Mutex */
pthread_mutex_init(&mutex1, NULL);
#endif
-
+
}
VOID error_handler(void)
@@ -213,7 +213,7 @@ VOID pthread_0_signal_handler(int signo)
called from pthread 0. */
if (pthread_self() != pthread_0)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -221,7 +221,7 @@ VOID pthread_0_signal_handler(int signo)
/* Check for proper signal. */
if (signo != 15)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -251,23 +251,23 @@ VOID *pthread_0_entry(VOID *pthread0_input)
if (pt0_status)
error_handler();
- /* This pthread simply sits in while-forever-sleep loop */
- while(1)
+ /* This pthread simply sits in while-forever-sleep loop */
+ while(1)
{
/* Increment the pthread counter.*/
pthread_0_counter++;
/* Raise the signal. */
pt0_status = pthread_kill(pthread_0, 15);
-
+
/* Check for errors. */
if ((pt0_status) || (pthread_0_counter != pthread_0_signal_counter))
{
error_handler();
break;
}
-
-#if 0
+
+#if 0
/* sleep for a while */
thread_0_sleep_time.tv_nsec = 999999999;
thread_0_sleep_time.tv_sec = 4;
@@ -288,13 +288,13 @@ INT pt1_status=0;
VOID *pthread_1_entry(VOID *pthread1_input)
{
-
+
struct timespec thread_1_sleep_time={0,0};
/* This thread simply sends a messages to a queue shared by pthread 2. */
while(1)
{
-
+
/* Increment the thread counter. */
pthread_1_counter++;
/* Send message to queue 0. */
@@ -320,7 +320,7 @@ INT pt2_status;
VOID *pthread_2_entry(VOID *pthread2_input)
{
-CHAR msgr0[MAX_MESSAGE_SIZE];
+CHAR msgr0[MAX_MESSAGE_SIZE];
ULONG priority;
struct timespec thread_2_sleep_time={0,0};
@@ -330,7 +330,7 @@ struct timespec thread_2_sleep_time={0,0};
/* Increment the thread counter. */
pthread_2_counter++;
pt2_status = mq_receive(q_des,msgr0,MAX_MESSAGE_SIZE,&priority);
-
+
if(pt2_status != 0)
break;
@@ -357,7 +357,7 @@ struct timespec thread_3_sleep_time={0,0};
/* Increment the thread counter. */
pthread_3_counter++;
- /* Get the semaphore with suspension. */
+ /* Get the semaphore with suspension. */
pt3_status = sem_wait(sem);
/* Check status. */
diff --git a/utility/rtos_compatibility_layers/posix/posix_signal_sigmask_test.c b/utility/rtos_compatibility_layers/posix/posix_signal_sigmask_test.c
index 2a7cf069..1f9c690b 100644
--- a/utility/rtos_compatibility_layers/posix/posix_signal_sigmask_test.c
+++ b/utility/rtos_compatibility_layers/posix/posix_signal_sigmask_test.c
@@ -61,7 +61,7 @@ VOID tx_application_define(VOID *first_unused_memory)
struct sched_param param;
-
+
/* Init POSIX Wrapper */
storage_ptr = (VOID*) posix_initialize((VOID*)free_memory);
@@ -74,15 +74,15 @@ struct sched_param param;
/* Create a sched_param structure */
memset(&param, 0, sizeof(param));
-
+
/* Now create all pthreads , firstly modify respective ptheread
attribute with desired priority and stack start address and then create the pthread */
-
+
/* Create pthread 0. */
param.sched_priority = 15;
pthread_attr_setschedparam(&ptattr0, &param);
pthread_attr_setstackaddr(&ptattr0, storage_ptr );
- storage_ptr = (UINT *) storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = (UINT *) storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_0, &ptattr0,pthread_0_entry,NULL);
@@ -90,7 +90,7 @@ struct sched_param param;
param.sched_priority = 10;
pthread_attr_setschedparam(&ptattr1, &param);
pthread_attr_setstackaddr(&ptattr1, (VOID*) storage_ptr );
- storage_ptr = (UINT *) storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = (UINT *) storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_1, &ptattr1,pthread_1_entry,NULL);
}
@@ -118,7 +118,7 @@ int status;
called from pthread 0. */
if (pthread_self() != pthread_0)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -126,7 +126,7 @@ int status;
/* Check for proper signal. */
if (signo != 13)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -138,11 +138,11 @@ int status;
sigemptyset(&wait_set);
sigaddset(&wait_set, 12);
status = sigwait(&wait_set, &signal_received);
-
+
/* Check for an error. */
if ((status) || (signal_received != 12))
{
-
+
/* Call error handler. */
error_handler();
}
@@ -161,7 +161,7 @@ int status;
called from pthread 0. */
if (pthread_self() != pthread_0)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -169,7 +169,7 @@ int status;
/* Check for proper signal. */
if (signo != 14)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -181,11 +181,11 @@ int status;
sigemptyset(&wait_set);
sigaddset(&wait_set, 13);
status = sigwait(&wait_set, &signal_received);
-
+
/* Check for an error. */
if ((status) || (signal_received != 13))
{
-
+
/* Call error handler. */
error_handler();
}
@@ -204,7 +204,7 @@ int status;
called from pthread 0. */
if (pthread_self() != pthread_0)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -212,7 +212,7 @@ int status;
/* Check for proper signal. */
if (signo != 15)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -224,11 +224,11 @@ int status;
sigemptyset(&wait_set);
sigaddset(&wait_set, 14);
status = sigwait(&wait_set, &signal_received);
-
+
/* Check for an error. */
if ((status) || (signal_received != 14))
{
-
+
/* Call error handler. */
error_handler();
}
@@ -242,7 +242,7 @@ VOID pthread_0_signal_handler16(int signo)
called from pthread 0. */
if (pthread_self() != pthread_0)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -250,7 +250,7 @@ VOID pthread_0_signal_handler16(int signo)
/* Check for proper signal. */
if (signo != 16)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -304,7 +304,7 @@ int signal_received;
sigemptyset(&new_mask);
sigaddset(&new_mask, 15);
pt0_status = pthread_sigmask(SIG_BLOCK, &new_mask, &old_mask);
-
+
/* Check for error. */
if (pt0_status)
error_handler();
@@ -313,21 +313,21 @@ int signal_received;
sigemptyset(&new_mask);
sigaddset(&new_mask, 16);
pt0_status = pthread_sigmask(SIG_BLOCK, &new_mask, &old_mask);
-
+
/* Check for error. */
if (pt0_status)
error_handler();
/* Simply restore the signal for this first test. */
pt0_status = pthread_sigmask(SIG_SETMASK, &old_mask, &old_mask);
-
+
/* Check for error. */
if (pt0_status)
error_handler();
-
+
/* Now do it again, but set a signal when the signal is masked. */
pt0_status = pthread_sigmask(SIG_BLOCK, &new_mask, &old_mask);
-
+
/* Check for error. */
if (pt0_status)
error_handler();
@@ -338,7 +338,7 @@ int signal_received;
/* Check for error. */
if (pt0_status)
error_handler();
-
+
/* Now unblock this signal to trigger the actual activation of the signal. */
pt0_status = pthread_sigmask(SIG_UNBLOCK, &new_mask, &old_mask);
@@ -348,7 +348,7 @@ int signal_received;
/* Now do it all again, but perform a sigwait when the signal is masked and pending. */
pt0_status = pthread_sigmask(SIG_BLOCK, &new_mask, &old_mask);
-
+
/* Check for error. */
if (pt0_status)
error_handler();
@@ -363,23 +363,23 @@ int signal_received;
/* Wait on signal 16. */
sigemptyset(&wait_set);
sigaddset(&wait_set, 16);
-
+
/* Now perform a sigwait on signal 16. */
pt0_status = sigwait(&wait_set, &signal_received);
-
+
/* Check for error. */
if ((pt0_status) || (pthread_0_signal_counter16 != 2) || (signal_received != 16))
error_handler();
-
+
/* Now unblock this signal to trigger the actual activation of the signal. */
pt0_status = pthread_sigmask(SIG_UNBLOCK, &new_mask, &old_mask);
-
+
/* Check for error. */
if (pt0_status)
error_handler();
- /* This pthread simply sits in while-forever-sleep loop */
- while(1)
+ /* This pthread simply sits in while-forever-sleep loop */
+ while(1)
{
/* Increment the pthread counter.*/
pthread_0_counter++;
@@ -388,22 +388,22 @@ int signal_received;
sigemptyset(&wait_set);
sigaddset(&wait_set, 15);
- /* Signal wait. */
+ /* Signal wait. */
pt0_status = sigwait(&wait_set, &signal_received);
/* Check for errors. */
- if ((pt0_status) ||
+ if ((pt0_status) ||
(signal_received != 15) ||
- (pthread_0_counter != pthread_0_signal_counter15) ||
+ (pthread_0_counter != pthread_0_signal_counter15) ||
(pthread_0_counter != pthread_0_signal_counter14) ||
(pthread_0_counter != pthread_0_signal_counter13))
{
-
+
/* In this test, this thread should never resume! */
error_handler();
/* Break out of the loop. */
- break;
+ break;
}
}
@@ -415,12 +415,12 @@ INT pt1_status=0;
VOID *pthread_1_entry(VOID *pthread1_input)
{
-
+
/* This thread simply sends a messages to a queue shared by pthread 2. */
while(1)
{
-
+
/* Increment the thread counter. */
pthread_1_counter++;
@@ -434,9 +434,9 @@ VOID *pthread_1_entry(VOID *pthread1_input)
pt1_status += pthread_kill(pthread_0, 12);
/* Check for errors. */
- if ((pt1_status) ||
+ if ((pt1_status) ||
(pthread_0_counter != (pthread_1_counter+1)) ||
- (pthread_1_counter != pthread_0_signal_counter15) ||
+ (pthread_1_counter != pthread_0_signal_counter15) ||
(pthread_1_counter != pthread_0_signal_counter14) ||
(pthread_1_counter != pthread_0_signal_counter13))
{
@@ -445,6 +445,6 @@ VOID *pthread_1_entry(VOID *pthread1_input)
break;
}
}
-
+
return(&pt1_status);
}
diff --git a/utility/rtos_compatibility_layers/posix/posix_signal_sigwait_test.c b/utility/rtos_compatibility_layers/posix/posix_signal_sigwait_test.c
index 80d6402a..aa459735 100644
--- a/utility/rtos_compatibility_layers/posix/posix_signal_sigwait_test.c
+++ b/utility/rtos_compatibility_layers/posix/posix_signal_sigwait_test.c
@@ -59,7 +59,7 @@ VOID tx_application_define(VOID *first_unused_memory)
struct sched_param param;
-
+
/* Init POSIX Wrapper */
storage_ptr = (VOID*) posix_initialize((VOID*)free_memory);
@@ -72,15 +72,15 @@ struct sched_param param;
/* Create a sched_param structure */
memset(&param, 0, sizeof(param));
-
+
/* Now create all pthreads , firstly modify respective ptheread
attribute with desired priority and stack start address and then create the pthread */
-
+
/* Create pthread 0. */
param.sched_priority = 15;
pthread_attr_setschedparam(&ptattr0, &param);
pthread_attr_setstackaddr(&ptattr0, storage_ptr );
- storage_ptr = (UINT *) storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = (UINT *) storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_0, &ptattr0,pthread_0_entry,NULL);
@@ -88,7 +88,7 @@ struct sched_param param;
param.sched_priority = 10;
pthread_attr_setschedparam(&ptattr1, &param);
pthread_attr_setstackaddr(&ptattr1, (VOID*) storage_ptr );
- storage_ptr = (UINT *) storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = (UINT *) storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_1, &ptattr1,pthread_1_entry,NULL);
}
@@ -116,7 +116,7 @@ int status;
called from pthread 0. */
if (pthread_self() != pthread_0)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -124,7 +124,7 @@ int status;
/* Check for proper signal. */
if (signo != 13)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -136,11 +136,11 @@ int status;
sigemptyset(&wait_set);
sigaddset(&wait_set, 12);
status = sigwait(&wait_set, &signal_received);
-
+
/* Check for an error. */
if ((status) || (signal_received != 12))
{
-
+
/* Call error handler. */
error_handler();
}
@@ -159,7 +159,7 @@ int status;
called from pthread 0. */
if (pthread_self() != pthread_0)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -167,7 +167,7 @@ int status;
/* Check for proper signal. */
if (signo != 14)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -179,11 +179,11 @@ int status;
sigemptyset(&wait_set);
sigaddset(&wait_set, 13);
status = sigwait(&wait_set, &signal_received);
-
+
/* Check for an error. */
if ((status) || (signal_received != 13))
{
-
+
/* Call error handler. */
error_handler();
}
@@ -202,7 +202,7 @@ int status;
called from pthread 0. */
if (pthread_self() != pthread_0)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -210,7 +210,7 @@ int status;
/* Check for proper signal. */
if (signo != 15)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -222,11 +222,11 @@ int status;
sigemptyset(&wait_set);
sigaddset(&wait_set, 14);
status = sigwait(&wait_set, &signal_received);
-
+
/* Check for an error. */
if ((status) || (signal_received != 14))
{
-
+
/* Call error handler. */
error_handler();
}
@@ -265,8 +265,8 @@ int signal_received;
if (pt0_status)
error_handler();
- /* This pthread simply sits in while-forever-sleep loop */
- while(1)
+ /* This pthread simply sits in while-forever-sleep loop */
+ while(1)
{
/* Increment the pthread counter.*/
pthread_0_counter++;
@@ -275,22 +275,22 @@ int signal_received;
sigemptyset(&wait_set);
sigaddset(&wait_set, 15);
- /* Signal wait. */
+ /* Signal wait. */
pt0_status = sigwait(&wait_set, &signal_received);
/* Check for errors. */
- if ((pt0_status) ||
+ if ((pt0_status) ||
(signal_received != 15) ||
- (pthread_0_counter != pthread_0_signal_counter15) ||
+ (pthread_0_counter != pthread_0_signal_counter15) ||
(pthread_0_counter != pthread_0_signal_counter14) ||
(pthread_0_counter != pthread_0_signal_counter13))
{
-
+
/* In this test, this thread should never resume! */
error_handler();
/* Break out of the loop. */
- break;
+ break;
}
}
@@ -302,12 +302,12 @@ INT pt1_status=0;
VOID *pthread_1_entry(VOID *pthread1_input)
{
-
+
/* This thread simply sends a messages to a queue shared by pthread 2. */
while(1)
{
-
+
/* Increment the thread counter. */
pthread_1_counter++;
@@ -321,9 +321,9 @@ VOID *pthread_1_entry(VOID *pthread1_input)
pt1_status += pthread_kill(pthread_0, 12);
/* Check for errors. */
- if ((pt1_status) ||
+ if ((pt1_status) ||
(pthread_0_counter != (pthread_1_counter+1)) ||
- (pthread_1_counter != pthread_0_signal_counter15) ||
+ (pthread_1_counter != pthread_0_signal_counter15) ||
(pthread_1_counter != pthread_0_signal_counter14) ||
(pthread_1_counter != pthread_0_signal_counter13))
{
@@ -332,7 +332,7 @@ VOID *pthread_1_entry(VOID *pthread1_input)
break;
}
}
-
+
return(&pt1_status);
}
diff --git a/utility/rtos_compatibility_layers/posix/posix_signal_suspended_thread_test.c b/utility/rtos_compatibility_layers/posix/posix_signal_suspended_thread_test.c
index 723c80db..40d11eea 100644
--- a/utility/rtos_compatibility_layers/posix/posix_signal_suspended_thread_test.c
+++ b/utility/rtos_compatibility_layers/posix/posix_signal_suspended_thread_test.c
@@ -66,7 +66,7 @@ VOID tx_application_define(VOID *first_unused_memory)
struct sched_param param;
-
+
/* Init POSIX Wrapper */
storage_ptr = (VOID*) posix_initialize((VOID*)free_memory);
@@ -79,15 +79,15 @@ struct sched_param param;
/* Create a sched_param structure */
memset(&param, 0, sizeof(param));
-
+
/* Now create all pthreads , firstly modify respective ptheread
attribute with desired priority and stack start address and then create the pthread */
-
+
/* Create pthread 0. */
param.sched_priority = 15;
pthread_attr_setschedparam(&ptattr0, &param);
pthread_attr_setstackaddr(&ptattr0, storage_ptr );
- storage_ptr = (UINT *) storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = (UINT *) storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_0, &ptattr0,pthread_0_entry,NULL);
@@ -95,7 +95,7 @@ struct sched_param param;
param.sched_priority = 10;
pthread_attr_setschedparam(&ptattr1, &param);
pthread_attr_setstackaddr(&ptattr1, (VOID*) storage_ptr );
- storage_ptr = (UINT *) storage_ptr + DEMO_STACK_SIZE;
+ storage_ptr = (UINT *) storage_ptr + DEMO_STACK_SIZE;
pthread_create (&pthread_1, &ptattr1,pthread_1_entry,NULL);
@@ -123,7 +123,7 @@ VOID pthread_0_signal_handler13(int signo)
called from pthread 0. */
if (pthread_self() != pthread_0)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -131,7 +131,7 @@ VOID pthread_0_signal_handler13(int signo)
/* Check for proper signal. */
if (signo != 13)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -148,7 +148,7 @@ VOID pthread_0_signal_handler14(int signo)
called from pthread 0. */
if (pthread_self() != pthread_0)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -156,7 +156,7 @@ VOID pthread_0_signal_handler14(int signo)
/* Check for proper signal. */
if (signo != 14)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -176,7 +176,7 @@ VOID pthread_0_signal_handler15(int signo)
called from pthread 0. */
if (pthread_self() != pthread_0)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -184,7 +184,7 @@ VOID pthread_0_signal_handler15(int signo)
/* Check for proper signal. */
if (signo != 15)
{
-
+
/* Call error handler. */
error_handler();
}
@@ -226,16 +226,16 @@ VOID *pthread_0_entry(VOID *pthread0_input)
error_handler();
- /* Get the semaphore with suspension. */
+ /* Get the semaphore with suspension. */
pt0_status = sem_wait(sem);
- /* This pthread simply sits in while-forever-sleep loop */
- while(1)
+ /* This pthread simply sits in while-forever-sleep loop */
+ while(1)
{
/* Increment the pthread counter.*/
pthread_0_counter++;
- /* Get the semaphore with suspension. */
+ /* Get the semaphore with suspension. */
pt0_status = sem_wait(sem);
/* In this test, this thread should never resume! */
@@ -244,9 +244,9 @@ VOID *pthread_0_entry(VOID *pthread0_input)
/* Check for error condition. */
if (pt0_status)
{
-
+
/* Break out of the loop. */
- break;
+ break;
}
}
@@ -258,12 +258,12 @@ INT pt1_status=0;
VOID *pthread_1_entry(VOID *pthread1_input)
{
-
+
/* This thread simply sends a messages to a queue shared by pthread 2. */
while(1)
{
-
+
/* Increment the thread counter. */
pthread_1_counter++;
@@ -271,9 +271,9 @@ VOID *pthread_1_entry(VOID *pthread1_input)
pt1_status = pthread_kill(pthread_0, 15);
/* Check for errors. */
- if ((pt1_status) ||
+ if ((pt1_status) ||
(pthread_0_counter != 1) ||
- (pthread_1_counter != pthread_0_signal_counter15) ||
+ (pthread_1_counter != pthread_0_signal_counter15) ||
(pthread_1_counter != pthread_0_signal_counter14) ||
(pthread_1_counter != pthread_0_signal_counter13))
{
@@ -282,7 +282,7 @@ VOID *pthread_1_entry(VOID *pthread1_input)
break;
}
}
-
+
return(&pt1_status);
}
diff --git a/utility/rtos_compatibility_layers/posix/pthread.h b/utility/rtos_compatibility_layers/posix/pthread.h
index bbd0761c..b248a38b 100644
--- a/utility/rtos_compatibility_layers/posix/pthread.h
+++ b/utility/rtos_compatibility_layers/posix/pthread.h
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -33,13 +34,6 @@
/* This file defines the constants, structures, etc.needed to */
/* implement the Evacuation Kit for POSIX Users (POSIX) */
/* */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
#ifndef _PTHREAD_H
diff --git a/utility/rtos_compatibility_layers/posix/px_abs_time_to_rel_ticks.c b/utility/rtos_compatibility_layers/posix/px_abs_time_to_rel_ticks.c
index 18a64e35..79a7b90f 100644
--- a/utility/rtos_compatibility_layers/posix/px_abs_time_to_rel_ticks.c
+++ b/utility/rtos_compatibility_layers/posix/px_abs_time_to_rel_ticks.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -43,12 +44,6 @@
/* timespec structure into the relative number of timer ticks until */
/* that time will occur. */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
ULONG posix_abs_time_to_rel_ticks(struct timespec *abs_timeout)
{
@@ -57,7 +52,7 @@ ULONG posix_abs_time_to_rel_ticks(struct timespec *abs_timeout)
current_ticks = tx_time_get();
/* convert ns to ticks (will lose any ns < 1 tick) */
ticks_ns = abs_timeout->tv_nsec / NANOSECONDS_IN_CPU_TICK;
- /*
+ /*
* if ns < 1 tick were lost, bump up to next tick so the delay is never
* less than what was specified.
*/
diff --git a/utility/rtos_compatibility_layers/posix/px_clock_getres.c b/utility/rtos_compatibility_layers/posix/px_clock_getres.c
index 80d16f66..5153500b 100644
--- a/utility/rtos_compatibility_layers/posix/px_clock_getres.c
+++ b/utility/rtos_compatibility_layers/posix/px_clock_getres.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,51 +27,45 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* clock_getres PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* clock_getres PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This subroutine returns the Clock resolution of the Threadx real */
/* time clock in nanoseconds */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* clockid_t, tspec */
/* */
-/* OUTPUT */
-/* */
+/* OUTPUT */
+/* */
/* error code */
/* */
-/* CALLS */
-/* */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* Application Code */
/* */
/**************************************************************************/
INT clock_getres(clockid_t t, struct timespec * tspec)
{
-
+
if(t==CLOCK_REALTIME)
{
if(tspec) tspec->tv_nsec= NANOSECONDS_IN_CPU_TICK;
return(OK);
}
else return(EINVAL);
-
+
}
diff --git a/utility/rtos_compatibility_layers/posix/px_clock_gettime.c b/utility/rtos_compatibility_layers/posix/px_clock_gettime.c
index f7c96797..964c10c7 100644
--- a/utility/rtos_compatibility_layers/posix/px_clock_gettime.c
+++ b/utility/rtos_compatibility_layers/posix/px_clock_gettime.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,49 +27,43 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* clock_gettime PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* clock_gettime PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This subroutine returns the time. The source of the time */
/* is the internal Threadx timer variable, which keeps track */
/* of the number of ticks of the Threadx timer ISR. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* clockid_t, tspec */
/* */
-/* OUTPUT */
-/* */
+/* OUTPUT */
+/* */
/* error code */
/* */
-/* CALLS */
-/* */
+/* CALLS */
+/* */
/* tx_time_get ThreadX function */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT clock_gettime(clockid_t t, struct timespec * tspec)
{
ULONG tx_time;
-
+
if(t==CLOCK_REALTIME)
{
tx_time=tx_time_get();
@@ -76,9 +71,9 @@ INT clock_gettime(clockid_t t, struct timespec * tspec)
tspec->tv_sec = tx_time / CPU_TICKS_PER_SECOND;
tspec->tv_nsec = (ULONG) ((tx_time - tspec->tv_sec*CPU_TICKS_PER_SECOND) * NANOSECONDS_IN_CPU_TICK);
-
+
return(OK);
}
else return(EINVAL);
-
+
}
diff --git a/utility/rtos_compatibility_layers/posix/px_clock_settime.c b/utility/rtos_compatibility_layers/posix/px_clock_settime.c
index 588de88f..70dbbe86 100644
--- a/utility/rtos_compatibility_layers/posix/px_clock_settime.c
+++ b/utility/rtos_compatibility_layers/posix/px_clock_settime.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,50 +27,44 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* clock_settime PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* clock_settime PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This subroutine sets the internal Threadx timer tick variable */
/* to the time specificed in the tspec variable after conversion */
/* if tspec->tv_sec is 0 the clock with be set to the value of */
/* tspec->tv_nsec */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* clockid_t, tspec */
/* */
-/* OUTPUT */
-/* */
+/* OUTPUT */
+/* */
/* error code */
/* */
-/* CALLS */
-/* */
+/* CALLS */
+/* */
/* tx_time_set ThreadX function */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT clock_settime(clockid_t t, const struct timespec * tspec)
{
ULONG tx_time;
-
+
if(t==CLOCK_REALTIME)
{
tx_time=(ULONG)((tspec->tv_sec * CPU_TICKS_PER_SECOND) + (tspec->tv_nsec / NANOSECONDS_IN_CPU_TICK));
diff --git a/utility/rtos_compatibility_layers/posix/px_cond_broadcast.c b/utility/rtos_compatibility_layers/posix/px_cond_broadcast.c
index b9c5faee..f9c8f151 100644
--- a/utility/rtos_compatibility_layers/posix/px_cond_broadcast.c
+++ b/utility/rtos_compatibility_layers/posix/px_cond_broadcast.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,18 +27,18 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_cond_broadcast PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_cond_broadcast PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* These functions shall unblock all threads currently blocked on a */
/* specified condition variable cond. */
/* If more than one thread is blocked on a condition variable, */
@@ -53,20 +54,20 @@
/* calling pthread_cond_wait or pthread_cond_timedwait have associated */
/* with the condition variable during their waits; however, */
/* if predictable scheduling behavior is required, then that mutex */
-/* shall be locked by the thread calling pthread_cond_broadcast. */
+/* shall be locked by the thread calling pthread_cond_broadcast. */
/* The pthread_cond_broadcast function shall have no effect if there */
/* are no threads currently blocked on cond. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* cond condition variable */
/* */
-/* OUTPUT */
-/* */
+/* OUTPUT */
+/* */
/* Ok if successful */
/* Error in case of any errors */
/* */
-/* CALLS */
+/* CALLS */
/* */
/* tx_semaphore_prioritize line up pthreads waiting at semaphore*/
/* tx_thread_identify to check which pthread? */
@@ -74,20 +75,14 @@
/* tx_semaphore_put ThreadX semaphore put service */
/* tx_thread_preemption_change to enable thread preemption */
/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* CALLED BY */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_cond_broadcast(pthread_cond_t *cond)
{
-
+
TX_SEMAPHORE *semaphore_ptr;
TX_THREAD *thread;
UINT status;
@@ -96,13 +91,13 @@ UINT old_threshold,dummy;
/* Get the condition variable's internal semaphore. */
- /* Simply convert the condition variable control block into a semaphore a cast */
+ /* Simply convert the condition variable control block into a semaphore a cast */
semaphore_ptr = (&( cond->cond_semaphore ));
sem_count = semaphore_ptr->tx_semaphore_suspended_count;
if (!sem_count)
return(OK);
-
+
status = tx_semaphore_prioritize(semaphore_ptr);
if ( status != TX_SUCCESS)
@@ -111,17 +106,17 @@ UINT old_threshold,dummy;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
}
-
+
/* get to know about current thread */
thread = tx_thread_identify();
/* Got the current thread , now raise its preemption threshold */
/* that way the current thread does not get descheduled when */
/* threads with higher priority are activated */
- tx_thread_preemption_change(thread,0,&old_threshold);
+ tx_thread_preemption_change(thread,0,&old_threshold);
while( sem_count)
- {
+ {
status = tx_semaphore_put(semaphore_ptr);
if ( status != TX_SUCCESS)
diff --git a/utility/rtos_compatibility_layers/posix/px_cond_destroy.c b/utility/rtos_compatibility_layers/posix/px_cond_destroy.c
index 54dd1eb7..efa99be1 100644
--- a/utility/rtos_compatibility_layers/posix/px_cond_destroy.c
+++ b/utility/rtos_compatibility_layers/posix/px_cond_destroy.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -25,18 +26,18 @@
#include "pthread.h" /* Posix API */
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_cond_destroy PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_cond_destroy PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* The pthread_cond_destroy function shall destroy the given condition */
/* variable specified by cond; the object becomes, in effect, */
/* uninitialized. */
@@ -44,29 +45,23 @@
/* pthread_cond_init;referencing the object after it has been destroyed*/
/* returns error. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* cond condition variable object */
/* */
/* OUTPUT */
-/* */
+/* */
/* OK If successful */
-/* EINVAL If error */
+/* EINVAL If error */
/* */
-/* CALLS */
+/* CALLS */
/* */
/* tx_semaphore_delete Deletes a semaphore internal to */
/* to the cond variable */
/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* CALLED BY */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_cond_destroy(pthread_cond_t *cond)
@@ -74,18 +69,18 @@ INT pthread_cond_destroy(pthread_cond_t *cond)
TX_SEMAPHORE *semaphore_ptr;
UINT status;
-
+
if (cond->in_use == TX_FALSE)
{
posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
- }
+ }
else
{
cond->in_use = TX_FALSE;
/* Get the condition variable's internal semaphore. */
- /* Simply convert the Condition variable control block into a semaphore a cast */
+ /* Simply convert the Condition variable control block into a semaphore a cast */
semaphore_ptr = (&( cond->cond_semaphore ));
status = tx_semaphore_delete(semaphore_ptr);
if (status != TX_SUCCESS)
@@ -93,8 +88,8 @@ UINT status;
posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
- }
+ }
return(OK);
- }
+ }
}
diff --git a/utility/rtos_compatibility_layers/posix/px_cond_init.c b/utility/rtos_compatibility_layers/posix/px_cond_init.c
index e204a13f..b376132d 100644
--- a/utility/rtos_compatibility_layers/posix/px_cond_init.c
+++ b/utility/rtos_compatibility_layers/posix/px_cond_init.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,18 +27,18 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_cond_init PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_cond_init PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function shall initialize the condition variable referenced by */
/* cond with attributes referenced by attr. If attr is NULL,the default*/
/* condition variable attributes shall be used; the effect is the same */
@@ -45,28 +46,22 @@
/* object. Upon successful initialization, the state of the condition */
/* variable shall become initialized. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* Nothing */
/* */
-/* OUTPUT */
-/* */
+/* OUTPUT */
+/* */
/* cond condition variable object */
/* attr attributes */
/* */
-/* CALLS */
-/* */
+/* CALLS */
+/* */
/* tx_semaphore_create create a semaphore internal to */
-/* cond variable */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* cond variable */
+/* CALLED BY */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *attr)
@@ -74,11 +69,11 @@ INT pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *attr)
TX_SEMAPHORE *semaphore_ptr;
UINT status;
-
+
cond->in_use = TX_TRUE;
/* Get the condition variable's internal semaphore. */
- /* Simply convert the COndition variable control block into a semaphore a cast */
- semaphore_ptr = (&( cond->cond_semaphore ));
+ /* Simply convert the COndition variable control block into a semaphore a cast */
+ semaphore_ptr = (&( cond->cond_semaphore ));
/* Now create the internal semaphore for this cond variable */
status = tx_semaphore_create(semaphore_ptr,"csem",0);
if (status != TX_SUCCESS)
diff --git a/utility/rtos_compatibility_layers/posix/px_cond_signal.c b/utility/rtos_compatibility_layers/posix/px_cond_signal.c
index 6d01a6e7..b1f4f285 100644
--- a/utility/rtos_compatibility_layers/posix/px_cond_signal.c
+++ b/utility/rtos_compatibility_layers/posix/px_cond_signal.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,18 +27,18 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_cond_signal PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_cond_signal PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function shall unblock at least one of the threads that are */
/* blocked on the specified condition variable cond */
/* (if any threads are blocked on cond).If more than one thread is */
@@ -58,28 +59,22 @@
/* This function shall have no effect if there are no threads currently*/
/* blocked on cond. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* Nothing */
/* */
-/* OUTPUT */
-/* */
+/* OUTPUT */
+/* */
/* Nothing */
/* */
-/* CALLS */
+/* CALLS */
/* */
/* tx_semaphore_prioritize line up pthreads waiting at semaphore*/
/* tx_semaphore_put ThreadX semaphore put service */
/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* CALLED BY */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_cond_signal(pthread_cond_t *cond)
@@ -89,7 +84,7 @@ TX_SEMAPHORE *semaphore_ptr;
UINT status;
/* Get the condition variable's internal semaphore. */
- /* Simply convert the COndition variable control block into a semaphore a cast */
+ /* Simply convert the COndition variable control block into a semaphore a cast */
semaphore_ptr = (&( cond->cond_semaphore ));
if ( semaphore_ptr->tx_semaphore_suspended_count)
{
@@ -107,6 +102,6 @@ UINT status;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
}
- }
+ }
return(OK);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_cond_timedwait.c b/utility/rtos_compatibility_layers/posix/px_cond_timedwait.c
index fd82c1d0..1b4660d4 100644
--- a/utility/rtos_compatibility_layers/posix/px_cond_timedwait.c
+++ b/utility/rtos_compatibility_layers/posix/px_cond_timedwait.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,17 +27,17 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_cond_timedwait PORTABLE C */
-/* 6.1.7 */
-/* AUTHOR */
-/* */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_cond_timedwait PORTABLE C */
+/* 6.1.7 */
+/* AUTHOR */
+/* */
/* William E. Lamie, Microsoft Corporation */
-/* */
-/* DESCRIPTION */
+/* */
+/* DESCRIPTION */
/* */
/* This function shall block on a condition variable. They shall be */
/* called with mutex locked by the calling thread or undefined behavior*/
@@ -61,38 +62,32 @@
/* pthread_cond_wait operations on the same condition variable is */
/* undefined; that is, a condition variable becomes bound to a unique */
/* mutex when a thread waits on the condition variable, and this */
-/* (dynamic) binding shall end when the wait returns. */
+/* (dynamic) binding shall end when the wait returns. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* cond condition variable */
/* mutex mutex to be associated with condition */
/* variable */
/* abstime time interval for wait */
/* */
-/* OUTPUT */
-/* */
+/* OUTPUT */
+/* */
/* OK if succesfull */
/* ERROR in case of any error */
/* */
-/* CALLS */
+/* CALLS */
/* */
/* pthread_mutex_unlock unlocks the mutex held by the caller */
/* tx_semaphore_get try to get sempaphore internal to cond */
/* tx_semaphore_prioritize prioritize all suspended pthreads */
/* pthread_mutex_lock lock the mutex */
/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William Lamie Initial Version 6.1.7 */
-/* */
-/**************************************************************************/
+/* CALLED BY */
+/* */
+/* Application Code */
+/* */
+/**************************************************************************/
INT pthread_cond_timedwait(pthread_cond_t *cond,pthread_mutex_t *mutex,
struct timespec *abstime)
{
@@ -107,11 +102,11 @@ TX_THREAD *thread;
thread = tx_thread_identify();
/* Raise its preemption threshold so it does not get descheduled. */
- tx_thread_preemption_change(thread,0,&old_threshold);
+ tx_thread_preemption_change(thread,0,&old_threshold);
pthread_mutex_unlock(mutex);
semaphore_ptr = (&( cond->cond_semaphore ));
-
+
wait_option = posix_abs_time_to_rel_ticks(abstime);
status = tx_semaphore_get(semaphore_ptr, wait_option);
@@ -139,6 +134,6 @@ TX_THREAD *thread;
return(EINVAL);
}
pthread_mutex_lock(mutex);
-
+
return(OK);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_cond_wait.c b/utility/rtos_compatibility_layers/posix/px_cond_wait.c
index 0e05418e..fbbbcd76 100644
--- a/utility/rtos_compatibility_layers/posix/px_cond_wait.c
+++ b/utility/rtos_compatibility_layers/posix/px_cond_wait.c
@@ -1,17 +1,18 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -25,17 +26,17 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_cond_wait PORTABLE C */
-/* 6.1.7 */
-/* AUTHOR */
-/* */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_cond_wait PORTABLE C */
+/* 6.1.7 */
+/* AUTHOR */
+/* */
/* William E. Lamie, Microsoft Corporation */
-/* */
-/* DESCRIPTION */
+/* */
+/* DESCRIPTION */
/* */
/* This function shall block on a condition variable. They shall be */
/* called with mutex locked by the calling thread or undefined behavior*/
@@ -58,37 +59,31 @@
/* pthread_cond_wait operations on the same condition variable is */
/* undefined; that is, a condition variable becomes bound to a unique */
/* mutex when a thread waits on the condition variable, and this */
-/* (dynamic) binding shall end when the wait returns. */
+/* (dynamic) binding shall end when the wait returns. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* cond condition variable */
/* mutex mutex to be associated with condition */
/* variable */
/* */
-/* OUTPUT */
-/* */
+/* OUTPUT */
+/* */
/* OK if succesfull */
/* ERROR in case of any error */
/* */
-/* CALLS */
+/* CALLS */
/* */
/* pthread_mutex_unlock unlocks the mutex held by the caller */
/* tx_semaphore_get try to get sempaphore internal to cond */
/* tx_semaphore_prioritize prioritize all suspended pthreads */
/* pthread_mutex_lock lock the mutex */
/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
-/**************************************************************************/
+/* CALLED BY */
+/* */
+/* Application Code */
+/* */
+/**************************************************************************/
INT pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
@@ -101,7 +96,7 @@ TX_THREAD *thread;
thread = tx_thread_identify();
/* Raise its preemption threshold so it does not get descheduled. */
- tx_thread_preemption_change(thread,0,&old_threshold);
+ tx_thread_preemption_change(thread,0,&old_threshold);
pthread_mutex_unlock(mutex);
@@ -128,7 +123,7 @@ TX_THREAD *thread;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
}
-
+
pthread_mutex_lock(mutex);
return(OK);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_error.c b/utility/rtos_compatibility_layers/posix/px_error.c
index f7b93cbd..7d950e14 100644
--- a/utility/rtos_compatibility_layers/posix/px_error.c
+++ b/utility/rtos_compatibility_layers/posix/px_error.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -56,51 +57,45 @@
/* */
/* POSIX internal code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
VOID posix_error_handler(ULONG error_code)
{
while (error_code) { ; }
}
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* posix_internal_error PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* posix_internal_error PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
-/* This function is invoked whenever an error is encountered */
-/* in the POSIX code. */
-/* */
-/* INPUT */
-/* */
-/* error_code Error code to handle */
-/* */
-/* OUTPUT */
-/* */
-/* None */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* POSIX internal code */
-/* */
-/* RELEASE HISTORY */
-/* */
+/* DESCRIPTION */
+/* */
+/* This function is invoked whenever an error is encountered */
+/* in the POSIX code. */
+/* */
+/* INPUT */
+/* */
+/* error_code Error code to handle */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* POSIX internal code */
+/* */
+/* RELEASE HISTORY */
+/* */
/* DATE NAME DESCRIPTION */
/* */
/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
diff --git a/utility/rtos_compatibility_layers/posix/px_in_thread_context.c b/utility/rtos_compatibility_layers/posix/px_in_thread_context.c
index a03d20a1..919ef2c6 100644
--- a/utility/rtos_compatibility_layers/posix/px_in_thread_context.c
+++ b/utility/rtos_compatibility_layers/posix/px_in_thread_context.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -57,12 +58,6 @@
/* */
/* posix internal code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
ULONG posix_in_thread_context(VOID)
{
@@ -72,7 +67,7 @@ ULONG posix_in_thread_context(VOID)
#ifndef TX_TIMER_PROCESS_IN_ISR
extern TX_THREAD _tx_timer_thread;
#endif
-
+
/* Return TX_FALSE if any of the following are true:
- we are in the scheduling loop (not in a thread);
- we are in an ISR
@@ -90,10 +85,10 @@ ULONG posix_in_thread_context(VOID)
|| (_tx_thread_system_state) /* In an ISR */
#ifndef TX_TIMER_PROCESS_IN_ISR
/* Timer routine */
- || (_tx_thread_current_ptr == &_tx_timer_thread)
+ || (_tx_thread_current_ptr == &_tx_timer_thread)
#endif
)
-
+
{
/* We are NOT in thread (thread) context. */
return (TX_FALSE);
diff --git a/utility/rtos_compatibility_layers/posix/px_int.h b/utility/rtos_compatibility_layers/posix/px_int.h
index f6d67ce4..1b0d085a 100644
--- a/utility/rtos_compatibility_layers/posix/px_int.h
+++ b/utility/rtos_compatibility_layers/posix/px_int.h
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -33,15 +34,6 @@
/* This file defines the constants, structures, etc.needed to */
/* implement the Evacuation Kit for POSIX Users (POSIX) */
/* */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* 10-31-2022 Scott Larson Remove unneeded values, */
-/* resulting in version 6.2.0 */
-/* */
/**************************************************************************/
#ifndef _TX_PX_INT_H
@@ -68,7 +60,7 @@ extern TX_THREAD * _tx_thread_execute_ptr;
/* declares posix objects in the px_pth_init.c file */
#ifdef PX_OBJECT_INIT
-#define PX_OBJECT_DECLARE
+#define PX_OBJECT_DECLARE
#else
#define PX_OBJECT_DECLARE extern
#endif
@@ -93,7 +85,7 @@ PX_OBJECT_DECLARE TX_THREAD posix_system_manager;
PX_OBJECT_DECLARE TX_BYTE_POOL posix_heap_byte_pool;
/* Define a static pool of pthread Control Blocks (TCB). If more pthreades are
- required the constant PTHREAD_THREADS_MAX (in tx_posix.h) may be modified. */
+ required the constant PTHREAD_THREADS_MAX (in tx_posix.h) may be modified. */
PX_OBJECT_DECLARE POSIX_TCB ptcb_pool[PTHREAD_THREADS_MAX];
#if POSIX_MAX_QUEUES!= 0
@@ -123,11 +115,11 @@ PX_OBJECT_DECLARE pthread_mutexattr_t posix_default_mutex_attr;
PX_OBJECT_DECLARE unsigned int posix_errno;
-
+
/**************************************************************************/
/* Local prototypes */
/**************************************************************************/
-/* Define Evacuation Kit for POSIX function prototypes. */
+/* Define Evacuation Kit for POSIX function prototypes. */
INT posix_get_pthread_errno(pthread_t ptid);
@@ -159,7 +151,7 @@ VOID posix_internal_error(ULONG error_code);
VOID posix_error_handler(ULONG error_code);
INT posix_memory_allocate(ULONG size, VOID **memory_ptr);
-
+
INT posix_queue_delete(POSIX_MSG_QUEUE * q_ptr);
VOID posix_putback_queue(TX_QUEUE * qid);
diff --git a/utility/rtos_compatibility_layers/posix/px_internal_signal_dispatch.c b/utility/rtos_compatibility_layers/posix/px_internal_signal_dispatch.c
index e7a7e4be..f23afb60 100644
--- a/utility/rtos_compatibility_layers/posix/px_internal_signal_dispatch.c
+++ b/utility/rtos_compatibility_layers/posix/px_internal_signal_dispatch.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -61,12 +62,6 @@
/* */
/* Internal Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
void internal_signal_dispatch(ULONG id)
{
@@ -81,7 +76,7 @@ VOID (*handler)(int);
/* Determine if the desired signal is valid. */
if (id > SIGRTMAX)
{
-
+
/* System error! */
posix_internal_error(444);
return;
@@ -108,7 +103,7 @@ VOID (*handler)(int);
/* See if there is a signal handler setup for this signal. */
if (handler)
{
-
+
/* Yes, there is a signal handler - call it! */
(handler)((int) id);
}
@@ -120,47 +115,47 @@ VOID (*handler)(int);
tx_event_flags_set(&(target_thread -> signals.signal_event_flags), ~(((ULONG) 1) << id), TX_AND);
/* Now we need to clear this signal and terminate this signal handler thread. */
-
+
/* Disable interrupts. */
TX_DISABLE
-
+
/* Clear this signal from the pending list. */
target_thread -> signals.signal_pending.signal_set = target_thread -> signals.signal_pending.signal_set & ~(((unsigned long) 1) << id);
-
+
/* Decrement the signal nesting count. */
target_thread -> signals.signal_nesting_depth--;
-
+
/* Is this the last nested signal leaving? */
if (target_thread -> signals.signal_nesting_depth == 0)
{
-
+
/* Clear the top signal thread link and resume the target thread. */
target_thread -> signals.top_signal_thread = NULL;
-
+
/* Restore interrupts. */
TX_RESTORE
-
+
/* Resume the target thread. */
tx_thread_resume((TX_THREAD *) target_thread);
}
else
{
-
+
/* Otherwise, there are more signal threads still active. */
-
+
/* Setup the new top signal thread pointer. */
target_thread -> signals.top_signal_thread = signal_thread -> signals.next_signal_thread;
/* Restore interrupts. */
TX_RESTORE
-
+
/* Resume the signal handler thread. */
tx_thread_resume((TX_THREAD *) signal_thread -> signals.next_signal_thread);
}
/* Now we need to mark this signal thread for destruction. */
posix_destroy_pthread(signal_thread,(VOID *) 0);
-
+
/* Self-suspend the current signal thread. */
- tx_thread_suspend((TX_THREAD *) signal_thread);
+ tx_thread_suspend((TX_THREAD *) signal_thread);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_memory_allocate.c b/utility/rtos_compatibility_layers/posix/px_memory_allocate.c
index c30a6c0b..5024e8d1 100644
--- a/utility/rtos_compatibility_layers/posix/px_memory_allocate.c
+++ b/utility/rtos_compatibility_layers/posix/px_memory_allocate.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -60,12 +61,6 @@
/* */
/* POSIX internal code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
INT posix_memory_allocate(ULONG size, VOID **memory_ptr)
{
@@ -84,7 +79,7 @@ INT retval;
/* Attempt to allocate the desired memory from the POSIX heap.
Do not wait - if memory isn't available, flag an error. */
retval = tx_byte_allocate((TX_BYTE_POOL *)&posix_heap_byte_pool, memory_ptr,
- size, TX_NO_WAIT);
+ size, TX_NO_WAIT);
/* Make sure the memory was obtained successfully. */
if (retval)
@@ -95,5 +90,5 @@ INT retval;
return(ERROR);
}
/* Return to caller. */
- return(retval);
+ return(retval);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_memory_release.c b/utility/rtos_compatibility_layers/posix/px_memory_release.c
index c071b97a..b028c47a 100644
--- a/utility/rtos_compatibility_layers/posix/px_memory_release.c
+++ b/utility/rtos_compatibility_layers/posix/px_memory_release.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -58,22 +59,16 @@
/* */
/* POSIX internal code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
VOID posix_memory_release(VOID * memory_ptr)
{
- /* Check if memory_ptr is part of the POSIX byte pool,
- * if not just return */
- if (((CHAR *)memory_ptr >=
- (CHAR *)&posix_heap_byte_pool.tx_byte_pool_start) ||
- ((CHAR *)memory_ptr <=
- (CHAR *)posix_heap_byte_pool.tx_byte_pool_start
+ /* Check if memory_ptr is part of the POSIX byte pool,
+ * if not just return */
+ if (((CHAR *)memory_ptr >=
+ (CHAR *)&posix_heap_byte_pool.tx_byte_pool_start) ||
+ ((CHAR *)memory_ptr <=
+ (CHAR *)posix_heap_byte_pool.tx_byte_pool_start
+ posix_heap_byte_pool.tx_byte_pool_size)) {
tx_byte_release(memory_ptr);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_mq_arrange_msg.c b/utility/rtos_compatibility_layers/posix/px_mq_arrange_msg.c
index 02649614..f72d0245 100644
--- a/utility/rtos_compatibility_layers/posix/px_mq_arrange_msg.c
+++ b/utility/rtos_compatibility_layers/posix/px_mq_arrange_msg.c
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -57,15 +58,6 @@
/* */
/* POSIX internal Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* 10-31-2022 Scott Larson Modified comments, */
-/* fixed message swap logic, */
-/* resulting in version 6.2.0 */
-/* */
/**************************************************************************/
ULONG posix_arrange_msg(TX_QUEUE *Queue, ULONG *pMsgPrio)
{
@@ -115,7 +107,7 @@ ULONG posix_arrange_msg(TX_QUEUE *Queue, ULONG *pMsgPrio)
/* copy FIFO order to the message */
minNo = *q_read;
-
+
/* Found higher priority message. */
maxPrio = priority;
@@ -131,10 +123,10 @@ ULONG posix_arrange_msg(TX_QUEUE *Queue, ULONG *pMsgPrio)
/* copy number to the local variable. */
number2 = *q_read;
-
+
/* Go to next message. */
q_read++;
-
+
/* find the oldest of the messages in this priority level. */
if( number2 < minNo )
{
diff --git a/utility/rtos_compatibility_layers/posix/px_mq_attr_init.c b/utility/rtos_compatibility_layers/posix/px_mq_attr_init.c
index e06ec746..e79bd6a2 100644
--- a/utility/rtos_compatibility_layers/posix/px_mq_attr_init.c
+++ b/utility/rtos_compatibility_layers/posix/px_mq_attr_init.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -57,12 +58,6 @@
/* */
/* POSIX internal Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
VOID posix_qattr_init(VOID)
{
@@ -70,7 +65,7 @@ VOID posix_qattr_init(VOID)
struct mq_attr * q_attr;
q_attr = &(posix_qattr_default);
-
+
/* This queue is not currently in use. */
q_attr->mq_flags = MQ_FLAGS;
q_attr->mq_maxmsg = MQ_MAXMSG;
diff --git a/utility/rtos_compatibility_layers/posix/px_mq_close.c b/utility/rtos_compatibility_layers/posix/px_mq_close.c
index 7bc067f5..69cfc2b9 100644
--- a/utility/rtos_compatibility_layers/posix/px_mq_close.c
+++ b/utility/rtos_compatibility_layers/posix/px_mq_close.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -60,24 +61,18 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
INT mq_close(mqd_t mqdes)
{
TX_INTERRUPT_SAVE_AREA
-TX_QUEUE * Queue;
+TX_QUEUE * Queue;
POSIX_MSG_QUEUE * q_ptr;
- /* Assign a temporary variable for clarity. */
- Queue = &(mqdes->f_data->queue);
- q_ptr = (POSIX_MSG_QUEUE * )Queue;
+ /* Assign a temporary variable for clarity. */
+ Queue = &(mqdes->f_data->queue);
+ q_ptr = (POSIX_MSG_QUEUE * )Queue;
/* First, check for an invalid queue pointer. */
if ( (!q_ptr) || ( (q_ptr -> px_queue_id) != PX_QUEUE_ID))
@@ -119,7 +114,7 @@ POSIX_MSG_QUEUE * q_ptr;
q_ptr ->open_count--;
- /* Destroy the basic Queue is the ref count is zero and
+ /* Destroy the basic Queue is the ref count is zero and
it is marked by unlink. */
if( (! q_ptr ->open_count ) && (q_ptr->unlink_flag == TX_TRUE))
{
diff --git a/utility/rtos_compatibility_layers/posix/px_mq_create.c b/utility/rtos_compatibility_layers/posix/px_mq_create.c
index 4b077bb0..dc9f0fc3 100644
--- a/utility/rtos_compatibility_layers/posix/px_mq_create.c
+++ b/utility/rtos_compatibility_layers/posix/px_mq_create.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -68,14 +69,6 @@
/* */
/* POSIX internal Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* 10-31-2022 Scott Larson Add 64-bit support, */
-/* resulting in version 6.2.0 */
-/* */
/**************************************************************************/
POSIX_MSG_QUEUE * posix_mq_create (const CHAR * mq_name,
struct mq_attr * msgq_attr)
@@ -121,7 +114,7 @@ TX_QUEUE *TheQ;
return(TX_NULL);
}
- /* Now create a ThreadX message queue.
+ /* Now create a ThreadX message queue.
to store only the message pointer and message length. */
temp1 = tx_queue_create((&(posix_q->queue)),
(CHAR *)mq_name,
@@ -147,11 +140,11 @@ TX_QUEUE *TheQ;
/* Restore maximum message length. */
posix_q->q_attr.mq_msgsize = msgq_attr->mq_msgsize;
- /* Flags are stored in que descriptor structure and
+ /* Flags are stored in que descriptor structure and
not in mq_att structure. */
- /* Create a byte pool for the queue.
- Determine how much memory we need to store all messages in this queue.
+ /* Create a byte pool for the queue.
+ Determine how much memory we need to store all messages in this queue.
11 bytes are added to counter overhead as well as alignment problem if any. */
size = ( ((msgq_attr->mq_maxmsg) + 1) * (msgq_attr->mq_msgsize + 11) );
@@ -188,7 +181,7 @@ TX_QUEUE *TheQ;
return(TX_NULL);
}
/* Put the queue back into the POSIX queue pool. */
- posix_putback_queue(TheQ);
+ posix_putback_queue(TheQ);
/* User configuration error - not enough memory. */
posix_errno = EBADF;
@@ -211,7 +204,7 @@ TX_QUEUE *TheQ;
/* Restore interrupts. */
TX_RESTORE
- /* Return ERROR.*/
+ /* Return ERROR.*/
return(TX_NULL);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_mq_find_queue.c b/utility/rtos_compatibility_layers/posix/px_mq_find_queue.c
index 3e7c7863..2788cd19 100644
--- a/utility/rtos_compatibility_layers/posix/px_mq_find_queue.c
+++ b/utility/rtos_compatibility_layers/posix/px_mq_find_queue.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -56,12 +57,6 @@
/* */
/* POSIX internal Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
POSIX_MSG_QUEUE * posix_find_queue(const CHAR *mq_name)
{
diff --git a/utility/rtos_compatibility_layers/posix/px_mq_get_new_queue.c b/utility/rtos_compatibility_layers/posix/px_mq_get_new_queue.c
index 6157bc6f..c9479806 100644
--- a/utility/rtos_compatibility_layers/posix/px_mq_get_new_queue.c
+++ b/utility/rtos_compatibility_layers/posix/px_mq_get_new_queue.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -58,24 +59,18 @@
/* */
/* POSIX internal Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
POSIX_MSG_QUEUE * posix_get_new_queue(ULONG maxnum)
{
-ULONG i;
-POSIX_MSG_QUEUE *q_ptr;
-VOID *bp;
-INT retval;
-ULONG size;
+ULONG i;
+POSIX_MSG_QUEUE *q_ptr;
+VOID *bp;
+INT retval;
+ULONG size;
- /* Determine how much memory we need for the queue.
+ /* Determine how much memory we need for the queue.
The queue holds "maxnum" entries; each entry is 2 ULONG. */
size = (maxnum * (TX_4_ULONG * sizeof(ULONG)));
@@ -91,14 +86,14 @@ ULONG size;
/* try to find one that is not "in use". */
/* Search the queue pool for an available queue. */
for (i = 0, q_ptr = &(posix_queue_pool[0]);
- i < POSIX_MAX_QUEUES;
+ i < POSIX_MAX_QUEUES;
i++, q_ptr++)
{
/* Make sure the queue is not "in use". */
if (q_ptr->in_use == TX_FALSE)
{
/* This queue is now in use. */
- q_ptr->in_use = TX_TRUE;
+ q_ptr->in_use = TX_TRUE;
/* Point to allocated memory. */
q_ptr->storage = bp;
@@ -106,10 +101,10 @@ ULONG size;
q_ptr->px_queue_id = PX_QUEUE_ID;
/* Stop searching. */
- break;
+ break;
}
}
- /* If we didn't find a free queue, free the allocated memory. */
+ /* If we didn't find a free queue, free the allocated memory. */
if ( i >= POSIX_MAX_QUEUES)
{
posix_memory_release(bp);
diff --git a/utility/rtos_compatibility_layers/posix/px_mq_get_queue_desc.c b/utility/rtos_compatibility_layers/posix/px_mq_get_queue_desc.c
index b26883e2..f311b02f 100644
--- a/utility/rtos_compatibility_layers/posix/px_mq_get_queue_desc.c
+++ b/utility/rtos_compatibility_layers/posix/px_mq_get_queue_desc.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -58,12 +59,6 @@
/* */
/* POSIX internal Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
struct mq_des * posix_get_queue_des(POSIX_MSG_QUEUE * q_ptr)
{
diff --git a/utility/rtos_compatibility_layers/posix/px_mq_open.c b/utility/rtos_compatibility_layers/posix/px_mq_open.c
index dbcb0b94..17bb7719 100644
--- a/utility/rtos_compatibility_layers/posix/px_mq_open.c
+++ b/utility/rtos_compatibility_layers/posix/px_mq_open.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -63,14 +64,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* 10-31-2022 Scott Larson Update comparison with NULL, */
-/* resulting in version 6.2.0 */
-/* */
/**************************************************************************/
mqd_t mq_open(const CHAR * mqName, ULONG oflags,...)
{
@@ -81,7 +74,7 @@ struct mq_attr *q_attr;
mode_t mode;
va_list create_queue;
ULONG len;
-ULONG temp1;
+ULONG temp1;
len = strlen(mqName);
if(len > PATH_MAX)
@@ -134,16 +127,16 @@ ULONG temp1;
return((struct mq_des *)ERROR);
}
- /* If q_attr is NULL then the default attributes of the struct
+ /* If q_attr is NULL then the default attributes of the struct
mq_attr are used */
if(q_attr == NULL)
{
q_attr = &(posix_qattr_default);
temp1 = q_attr->mq_maxmsg;
- temp1= temp1 ; /* Just to keep complier happy */
+ temp1= temp1 ; /* Just to keep complier happy */
}
- /* Create a queue which returns posix queue if successful and
+ /* Create a queue which returns posix queue if successful and
NULL if fails. */
if(!(posix_queue = posix_mq_create(mqName, q_attr)))
{
diff --git a/utility/rtos_compatibility_layers/posix/px_mq_priority_search.c b/utility/rtos_compatibility_layers/posix/px_mq_priority_search.c
index 137db751..da7c5996 100644
--- a/utility/rtos_compatibility_layers/posix/px_mq_priority_search.c
+++ b/utility/rtos_compatibility_layers/posix/px_mq_priority_search.c
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -58,14 +59,6 @@
/* */
/* POSIX internal Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* 10-31-2022 Scott Larson Add 64-bit support, */
-/* resulting in version 6.2.0 */
-/* */
/**************************************************************************/
ULONG posix_priority_search(mqd_t msgQId, ULONG priority)
{
diff --git a/utility/rtos_compatibility_layers/posix/px_mq_putback_queue.c b/utility/rtos_compatibility_layers/posix/px_mq_putback_queue.c
index dd6ae866..e3d67cad 100644
--- a/utility/rtos_compatibility_layers/posix/px_mq_putback_queue.c
+++ b/utility/rtos_compatibility_layers/posix/px_mq_putback_queue.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -56,12 +57,6 @@
/* */
/* POSIX internal Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
VOID posix_putback_queue(TX_QUEUE * qid)
{
diff --git a/utility/rtos_compatibility_layers/posix/px_mq_queue_delete.c b/utility/rtos_compatibility_layers/posix/px_mq_queue_delete.c
index ce677daf..aeb79f98 100644
--- a/utility/rtos_compatibility_layers/posix/px_mq_queue_delete.c
+++ b/utility/rtos_compatibility_layers/posix/px_mq_queue_delete.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -59,12 +60,6 @@
/* */
/* POSIX internal Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
INT posix_queue_delete(POSIX_MSG_QUEUE * q_ptr)
{
diff --git a/utility/rtos_compatibility_layers/posix/px_mq_queue_init.c b/utility/rtos_compatibility_layers/posix/px_mq_queue_init.c
index b8ba1935..2db344fc 100644
--- a/utility/rtos_compatibility_layers/posix/px_mq_queue_init.c
+++ b/utility/rtos_compatibility_layers/posix/px_mq_queue_init.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -57,12 +58,6 @@
/* */
/* POSIX internal Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
VOID posix_queue_init(VOID)
{
diff --git a/utility/rtos_compatibility_layers/posix/px_mq_receive.c b/utility/rtos_compatibility_layers/posix/px_mq_receive.c
index 8fac9832..bbc799a8 100644
--- a/utility/rtos_compatibility_layers/posix/px_mq_receive.c
+++ b/utility/rtos_compatibility_layers/posix/px_mq_receive.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -66,14 +67,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* 10-31-2022 Scott Larson Add 64-bit support, */
-/* resulting in version 6.2.0 */
-/* */
/**************************************************************************/
ssize_t mq_receive( mqd_t mqdes, VOID * pMsg, size_t msgLen, ULONG *pMsgPrio)
{
@@ -88,9 +81,9 @@ VOID * msgbuf1;
UCHAR * msgbuf2;
VOID * message_source;
- /* Assign a temporary variable for clarity. */
- Queue = &(mqdes->f_data->queue);
- q_ptr = (POSIX_MSG_QUEUE * )mqdes->f_data;
+ /* Assign a temporary variable for clarity. */
+ Queue = &(mqdes->f_data->queue);
+ q_ptr = (POSIX_MSG_QUEUE * )mqdes->f_data;
/* First, check for an invalid queue pointer. */
if ((!q_ptr) || ( (q_ptr -> px_queue_id) != PX_QUEUE_ID))
@@ -139,7 +132,7 @@ VOID * message_source;
else
wait_option = TX_WAIT_FOREVER;
-
+
/* Try to get a message from the message queue. */
/* Create a temporary buffer to get message pointer and message length. */
temp1 = posix_memory_allocate((sizeof(ULONG)) * TX_POSIX_MESSAGE_SIZE, (VOID**)&msgbuf1);
@@ -163,12 +156,12 @@ VOID * message_source;
/* All ok */
temp1 = OK;
- break;
+ break;
}
case TX_DELETED:
{
- break;
+ break;
}
case TX_QUEUE_EMPTY:
@@ -208,7 +201,7 @@ VOID * message_source;
return(temp1);
}
}
-
+
/* Assign a variable for clarity. */
my_ptr = ( ULONG *)msgbuf1;
@@ -221,10 +214,10 @@ VOID * message_source;
this_ptr = (CHAR *)(*my_ptr);
length_of_message = *(++my_ptr);
priority_of_message = *(++my_ptr);
-
+
#endif
message_source = (VOID *)this_ptr;
-
+
/* Copy message into supplied buffer. */
msgbuf2 = (UCHAR *)pMsg;
@@ -246,7 +239,7 @@ VOID * message_source;
{
*(msgbuf2++) = *((UCHAR *)(this_ptr++));
}
-
+
temp1 = mycount;
}
@@ -261,12 +254,12 @@ VOID * message_source;
return(ERROR);
}
- /* Copy message priority */
- if (pMsgPrio)
+ /* Copy message priority */
+ if (pMsgPrio)
{
*pMsgPrio = priority_of_message;
}
-
+
/* All done */
return(length_of_message);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_mq_reset_queue.c b/utility/rtos_compatibility_layers/posix/px_mq_reset_queue.c
index 88aa4beb..4710509d 100644
--- a/utility/rtos_compatibility_layers/posix/px_mq_reset_queue.c
+++ b/utility/rtos_compatibility_layers/posix/px_mq_reset_queue.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -57,12 +58,6 @@
/* */
/* POSIX internal code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
VOID posix_reset_queue(POSIX_MSG_QUEUE * q_ptr)
{
diff --git a/utility/rtos_compatibility_layers/posix/px_mq_send.c b/utility/rtos_compatibility_layers/posix/px_mq_send.c
index e67af7d3..464af01f 100644
--- a/utility/rtos_compatibility_layers/posix/px_mq_send.c
+++ b/utility/rtos_compatibility_layers/posix/px_mq_send.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -67,22 +68,14 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* 10-31-2022 Scott Larson Add 64-bit support, */
-/* resulting in version 6.2.0 */
-/* */
/**************************************************************************/
-INT mq_send( mqd_t mqdes, const CHAR * msg_ptr, size_t msg_len,
+INT mq_send( mqd_t mqdes, const CHAR * msg_ptr, size_t msg_len,
ULONG msg_prio )
{
-TX_QUEUE *Queue;
-UINT temp1;
-POSIX_MSG_QUEUE *q_ptr;
+TX_QUEUE *Queue;
+UINT temp1;
+POSIX_MSG_QUEUE *q_ptr;
VOID *bp;
UCHAR *source;
UCHAR *destination;
@@ -90,9 +83,9 @@ UCHAR *save_ptr;
ULONG mycount;
ULONG msg[TX_POSIX_MESSAGE_SIZE];
- /* Assign a temporary variable for clarity. */
- Queue = &(mqdes->f_data->queue);
- q_ptr = (POSIX_MSG_QUEUE * )mqdes->f_data;
+ /* Assign a temporary variable for clarity. */
+ Queue = &(mqdes->f_data->queue);
+ q_ptr = (POSIX_MSG_QUEUE * )mqdes->f_data;
/* First, check for an invalid queue pointer. */
if ( (!q_ptr) || ( (q_ptr -> px_queue_id) != PX_QUEUE_ID))
@@ -104,9 +97,9 @@ ULONG msg[TX_POSIX_MESSAGE_SIZE];
/* Return ERROR. */
return(ERROR);
}
- /* Make sure if we're calling this routine from a ISR timeout
- is set to zero. */
- if (!(tx_thread_identify()))
+ /* Make sure if we're calling this routine from a ISR timeout
+ is set to zero. */
+ if (!(tx_thread_identify()))
{
/* POSIX doesn't have error for this, hence give default. */
posix_errno = EINTR ;
@@ -166,7 +159,7 @@ ULONG msg[TX_POSIX_MESSAGE_SIZE];
return(ERROR);
}
- /* Now try to allocate memory to save the message from the
+ /* Now try to allocate memory to save the message from the
queue's byte pool. */
temp1 = tx_byte_allocate((TX_BYTE_POOL * )&(q_ptr->vq_message_area), &bp,
msg_len, TX_NO_WAIT);
@@ -174,8 +167,8 @@ ULONG msg[TX_POSIX_MESSAGE_SIZE];
if (temp1 != TX_SUCCESS)
{
posix_internal_error(9999);
- }
- /* Got the memory , Setup source and destination pointers
+ }
+ /* Got the memory , Setup source and destination pointers
Cast them in UCHAR as message length is in bytes. */
source = (UCHAR * ) msg_ptr;
destination = (UCHAR * ) bp;
diff --git a/utility/rtos_compatibility_layers/posix/px_mq_unlink.c b/utility/rtos_compatibility_layers/posix/px_mq_unlink.c
index d755d02f..e3e5f683 100644
--- a/utility/rtos_compatibility_layers/posix/px_mq_unlink.c
+++ b/utility/rtos_compatibility_layers/posix/px_mq_unlink.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -59,12 +60,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
INT mq_unlink(const CHAR * mqName)
{
diff --git a/utility/rtos_compatibility_layers/posix/px_mx_attr_destroy.c b/utility/rtos_compatibility_layers/posix/px_mx_attr_destroy.c
index 692db80c..3a36b8ed 100644
--- a/utility/rtos_compatibility_layers/posix/px_mx_attr_destroy.c
+++ b/utility/rtos_compatibility_layers/posix/px_mx_attr_destroy.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,48 +27,42 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_mutexattr_destroy PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_mutexattr_destroy PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function shall destroy a mutex attributes object; the object */
/* becomes,in effect,uninitialized.A destroyed attr attributes object */
/* can be reinitialized using pthread_mutexattr_init(); */
-/* */
-/* */
-/* INPUT */
+/* */
+/* */
+/* INPUT */
/* */
/* attr Address of the mutex attributes */
-/* object to be destroyed. */
-/* */
-/* OUTPUT */
-/* */
-/* 0 If successful */
+/* object to be destroyed. */
+/* */
+/* OUTPUT */
+/* */
+/* 0 If successful */
/* Value In case of any error or the results */
/* of referencing the object after it */
-/* has been destroyed. */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* has been destroyed. */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
diff --git a/utility/rtos_compatibility_layers/posix/px_mx_attr_getprotocol.c b/utility/rtos_compatibility_layers/posix/px_mx_attr_getprotocol.c
index 50a5572b..6526c155 100644
--- a/utility/rtos_compatibility_layers/posix/px_mx_attr_getprotocol.c
+++ b/utility/rtos_compatibility_layers/posix/px_mx_attr_getprotocol.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,46 +27,40 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_mutexattr_getprotocol PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_mutexattr_getprotocol PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function shall gets the mutex protocol attribute. */
/* The protocol of a mutex is contained in the protocol attribute. */
/* attributes. */
/* */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Pointer to the mutex attributes */
/* protocol Pointer to return mutex protocol */
-/* */
-/* OUTPUT */
-/* */
-/* 0 If successful */
-/* Value In case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* OUTPUT */
+/* */
+/* 0 If successful */
+/* Value In case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_mutexattr_getprotocol( pthread_mutexattr_t *attr, INT *protocol)
diff --git a/utility/rtos_compatibility_layers/posix/px_mx_attr_getpshared.c b/utility/rtos_compatibility_layers/posix/px_mx_attr_getpshared.c
index e3ea3df8..8621df8b 100644
--- a/utility/rtos_compatibility_layers/posix/px_mx_attr_getpshared.c
+++ b/utility/rtos_compatibility_layers/posix/px_mx_attr_getpshared.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,46 +27,40 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_mutexattr_getpshared PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_mutexattr_getpshared PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function shall gets the mutex protocol attribute. */
/* The protocol of a mutex is contained in the protocol attribute. */
/* attributes. */
/* */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Pointer to the mutex attributes */
/* pshared Pointer to return mutex pshared attr */
-/* */
-/* OUTPUT */
-/* */
-/* 0 If successful */
-/* Value In case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* OUTPUT */
+/* */
+/* 0 If successful */
+/* Value In case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_mutexattr_getpshared( pthread_mutexattr_t *attr, INT *pshared)
diff --git a/utility/rtos_compatibility_layers/posix/px_mx_attr_gettype.c b/utility/rtos_compatibility_layers/posix/px_mx_attr_gettype.c
index 7d391916..2b70d61e 100644
--- a/utility/rtos_compatibility_layers/posix/px_mx_attr_gettype.c
+++ b/utility/rtos_compatibility_layers/posix/px_mx_attr_gettype.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,46 +27,40 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_mutexattr_gettype PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_mutexattr_gettype PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function shall gets the mutex type attribute. */
/* The type of mutex is contained in the type attribute of the mutex */
/* attributes. */
/* */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Address of the mutex attributes */
/* type Pointer to return mutex type */
-/* */
-/* OUTPUT */
-/* */
-/* 0 If successful */
-/* Value In case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* OUTPUT */
+/* */
+/* 0 If successful */
+/* Value In case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_mutexattr_gettype( pthread_mutexattr_t *attr, INT *type)
diff --git a/utility/rtos_compatibility_layers/posix/px_mx_attr_initi.c b/utility/rtos_compatibility_layers/posix/px_mx_attr_initi.c
index f9778997..dd41b9a2 100644
--- a/utility/rtos_compatibility_layers/posix/px_mx_attr_initi.c
+++ b/utility/rtos_compatibility_layers/posix/px_mx_attr_initi.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,45 +27,39 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_mutexattr_init PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_mutexattr_init PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function initializes a pthread mutex attributes object to */
/* default values, if the object is already created this call will */
/* return an error. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Pointer to a mutex attributes */
-/* */
-/* OUTPUT */
-/* */
-/* 0 If successful */
-/* Value In case of any error */
-/* */
-/* CALLS */
-/* */
-/* posix_allocate_pthread_mutexattr Get a new mutexattr object */
+/* */
+/* OUTPUT */
+/* */
+/* 0 If successful */
+/* Value In case of any error */
+/* */
+/* CALLS */
+/* */
+/* posix_allocate_pthread_mutexattr Get a new mutexattr object */
/* set_default_mutexattr Set mutexattr with default values */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_mutexattr_init(pthread_mutexattr_t *attr)
@@ -73,7 +68,7 @@ INT pthread_mutexattr_init(pthread_mutexattr_t *attr)
TX_INTERRUPT_SAVE_AREA
- /* Disable interrupts. */
+ /* Disable interrupts. */
TX_DISABLE
/* Check this attributes object exists ? */
diff --git a/utility/rtos_compatibility_layers/posix/px_mx_attr_setprotocol.c b/utility/rtos_compatibility_layers/posix/px_mx_attr_setprotocol.c
index 52fa39ff..5654be6b 100644
--- a/utility/rtos_compatibility_layers/posix/px_mx_attr_setprotocol.c
+++ b/utility/rtos_compatibility_layers/posix/px_mx_attr_setprotocol.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,46 +27,40 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_mutexattr_setprotocol PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_mutexattr_setprotocol PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function shall sets the mutex protocol attribute. */
/* The protocol of a mutex is contained in the protocol attribute of */
/* the mutex attributes */
/* */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Pointer to the mutex attributes */
/* protocol mutex protocol */
-/* */
-/* OUTPUT */
-/* */
-/* 0 If successful */
-/* Value In case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* OUTPUT */
+/* */
+/* 0 If successful */
+/* Value In case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr, INT protocol)
@@ -81,8 +76,8 @@ INT pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr, INT protocol)
else
{
if (protocol == PTHREAD_PRIO_INHERIT )
- {
- attr->protocol = protocol;
+ {
+ attr->protocol = protocol;
return(OK);
}
else
diff --git a/utility/rtos_compatibility_layers/posix/px_mx_attr_setpshared.c b/utility/rtos_compatibility_layers/posix/px_mx_attr_setpshared.c
index b1790e35..22b3d8c5 100644
--- a/utility/rtos_compatibility_layers/posix/px_mx_attr_setpshared.c
+++ b/utility/rtos_compatibility_layers/posix/px_mx_attr_setpshared.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,44 +27,38 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_mutexattr_setpshared PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_mutexattr_setpshared PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function shall sets the mutex pshared attribute. */
/* */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Pointer to the mutex attributes */
/* pshared mutex pshared attr */
-/* */
-/* OUTPUT */
-/* */
-/* 0 If successful */
-/* Value In case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* OUTPUT */
+/* */
+/* 0 If successful */
+/* Value In case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_mutexattr_setpshared (pthread_mutexattr_t *attr, INT pshared)
@@ -79,8 +74,8 @@ INT pthread_mutexattr_setpshared (pthread_mutexattr_t *attr, INT pshared)
else
{
if ((pshared == PTHREAD_PROCESS_PRIVATE)||(pshared == PTHREAD_PROCESS_SHARED) )
- {
- attr->type = pshared;
+ {
+ attr->type = pshared;
return(OK);
}
else
diff --git a/utility/rtos_compatibility_layers/posix/px_mx_attr_settype.c b/utility/rtos_compatibility_layers/posix/px_mx_attr_settype.c
index f5524b17..68184a3c 100644
--- a/utility/rtos_compatibility_layers/posix/px_mx_attr_settype.c
+++ b/utility/rtos_compatibility_layers/posix/px_mx_attr_settype.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,46 +27,40 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_mutexattr_settype PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_mutexattr_settype PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function shall sets the mutex type attribute. */
/* The type of mutex is contained in the type attribute of the mutex */
/* attributes. */
/* ***** Only PTHREAD_MUTEX_RECURSIVE type is supported ****** */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Address of the mutex attributes */
/* type mutex type. */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_mutexattr_settype( pthread_mutexattr_t *attr, INT type)
@@ -81,8 +76,8 @@ INT pthread_mutexattr_settype( pthread_mutexattr_t *attr, INT type)
else
{
if (type == PTHREAD_MUTEX_RECURSIVE)
- {
- attr->type = type ;
+ {
+ attr->type = type ;
return(OK);
}
else
diff --git a/utility/rtos_compatibility_layers/posix/px_mx_destroy.c b/utility/rtos_compatibility_layers/posix/px_mx_destroy.c
index 479b160c..804c48d9 100644
--- a/utility/rtos_compatibility_layers/posix/px_mx_destroy.c
+++ b/utility/rtos_compatibility_layers/posix/px_mx_destroy.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,46 +27,40 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_mutex_destroy PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_mutex_destroy PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function shall destroy the mutex object referenced by mutex; */
/* the mutex object becomes,in effect, uninitialized.A destroyed mutex */
/* object can be reinitialized using pthread_mutex_init() */
/* It shall be safe to destroy an initialized mutex that is unlocked. */
/* Attempting to destroy a locked mutex results in undefined behavior. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* mutex Address of the mutex */
-/* */
-/* OUTPUT */
-/* */
-/* 0 If successful */
-/* Value In case of any error */
-/* */
-/* CALLS */
-/* */
-/* tx_mutex_delete ThreadX Mutex service */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* OUTPUT */
+/* */
+/* 0 If successful */
+/* Value In case of any error */
+/* */
+/* CALLS */
+/* */
+/* tx_mutex_delete ThreadX Mutex service */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_mutex_destroy(pthread_mutex_t *mutex)
@@ -75,7 +70,7 @@ TX_INTERRUPT_SAVE_AREA
TX_MUTEX *mutex_ptr;
INT status,retval;
-
+
/* Disable interrupts. */
TX_DISABLE
@@ -85,7 +80,7 @@ INT status,retval;
if (status == TX_SUCCESS)
{
mutex->in_use = TX_FALSE;
- retval = OK;
+ retval = OK;
}
else
{
diff --git a/utility/rtos_compatibility_layers/posix/px_mx_init.c b/utility/rtos_compatibility_layers/posix/px_mx_init.c
index 36821392..db4269d7 100644
--- a/utility/rtos_compatibility_layers/posix/px_mx_init.c
+++ b/utility/rtos_compatibility_layers/posix/px_mx_init.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,18 +27,18 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_mutex_init PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_mutex_init PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function shall init the mutex object referenced by mutex with */
/* attributes specified by attr. */
/* If attr is NULL, the default mutex attributes are used; the effect */
@@ -45,31 +46,25 @@
/* attributes object. Upon successful initialization,the state of the */
/* mutex becomes initialized and unlocked. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* mutex Pointer to a pthread mutex object */
/* attr Pointer to mutex attributes */
-/* */
-/* OUTPUT */
-/* */
-/* 0 If successful */
-/* Value In case of any error */
-/* */
-/* CALLS */
-/* */
-/* posix_internal_error In case of some special errors */
+/* */
+/* OUTPUT */
+/* */
+/* 0 If successful */
+/* Value In case of any error */
+/* */
+/* CALLS */
+/* */
+/* posix_internal_error In case of some special errors */
/* posix_in_thread_context Check whether called from a thread */
-/* tx_mutex_create Create a ThreadX Mutex object */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* tx_mutex_create Create a ThreadX Mutex object */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_mutex_init(pthread_mutex_t *mutex ,pthread_mutexattr_t *attr)
@@ -89,7 +84,7 @@ ULONG status,retval;
posix_internal_error(444);
}
- /* Disable interrupts. */
+ /* Disable interrupts. */
TX_DISABLE
/* Check for any pthread_mutexattr_t suggested */
@@ -102,9 +97,9 @@ ULONG status,retval;
{
/* attributes passed , check for validity */
if (( (attr->in_use) == TX_FALSE)|| (attr->type!=PTHREAD_MUTEX_RECURSIVE))
- {
+ {
/* attributes passed is not valid, return with an error */
- /* Restore interrupts. */
+ /* Restore interrupts. */
TX_RESTORE
posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
@@ -114,13 +109,13 @@ ULONG status,retval;
mutex_ptr = (&(mutex->mutex_info)) ;
- /* Now actually create the mutex */
+ /* Now actually create the mutex */
status = tx_mutex_create(mutex_ptr, "PMTX", TX_INHERIT);
-
+
if ( status == TX_SUCCESS)
{
mutex->in_use = TX_TRUE;
- retval = OK;
+ retval = OK;
}
else
{
@@ -129,7 +124,7 @@ ULONG status,retval;
posix_set_pthread_errno(EINVAL);
retval = EINVAL;
}
-
+
TX_RESTORE
- return(retval);
+ return(retval);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_mx_lock.c b/utility/rtos_compatibility_layers/posix/px_mx_lock.c
index 2754b6ac..226f2ea2 100644
--- a/utility/rtos_compatibility_layers/posix/px_mx_lock.c
+++ b/utility/rtos_compatibility_layers/posix/px_mx_lock.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,52 +27,46 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_mutex_lock PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_mutex_lock PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function locks the mutex object referenced. If the mutex is */
/* already locked, the calling thread shall block until the mutex */
/* becomes available. This operation shall return with the mutex object*/
/* referenced by mutex in the locked state with the calling thread as */
/* its owner. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* mutex Address of the mutex */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* tx_thread_identify Get calling thread's pointer */
-/* tx_mutex_get ThreadX Mutex Service */
/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* CALLS */
+/* */
+/* tx_thread_identify Get calling thread's pointer */
+/* tx_mutex_get ThreadX Mutex Service */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_mutex_lock(pthread_mutex_t *mutex )
{
-
+
TX_MUTEX *mutex_ptr;
TX_THREAD *thread_ptr;
INT retval,status;
@@ -91,7 +86,7 @@ INT retval,status;
case TX_SUCCESS:
retval = OK;
break;
-
+
default:
posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
diff --git a/utility/rtos_compatibility_layers/posix/px_mx_set_default_mutexattr.c b/utility/rtos_compatibility_layers/posix/px_mx_set_default_mutexattr.c
index d3a72e62..87d93ce0 100644
--- a/utility/rtos_compatibility_layers/posix/px_mx_set_default_mutexattr.c
+++ b/utility/rtos_compatibility_layers/posix/px_mx_set_default_mutexattr.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -27,41 +28,35 @@
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* set_default_mutexattr PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* set_default_mutexattr PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
-/* This function sets default mutex attr w/ default information. */
-/* */
-/* INPUT */
-/* */
-/* mutexattr mutex attr object pointer */
-/* */
-/* OUTPUT */
-/* */
-/* None */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Start-up code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* DESCRIPTION */
+/* */
+/* This function sets default mutex attr w/ default information. */
+/* */
+/* INPUT */
+/* */
+/* mutexattr mutex attr object pointer */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* Start-up code */
/* */
/**************************************************************************/
VOID set_default_mutexattr(pthread_mutexattr_t *mutexattr)
diff --git a/utility/rtos_compatibility_layers/posix/px_mx_timedlock.c b/utility/rtos_compatibility_layers/posix/px_mx_timedlock.c
index 9e8b82ef..b08338ce 100644
--- a/utility/rtos_compatibility_layers/posix/px_mx_timedlock.c
+++ b/utility/rtos_compatibility_layers/posix/px_mx_timedlock.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,18 +27,18 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_mutex_timedlock PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_mutex_timedlock PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function locks the mutex object referenced. If the mutex is */
/* already locked, the calling thread shall block until the mutex */
/* becomes available as in the pthread_mutex_lock( ) function. If the */
@@ -47,31 +48,25 @@
/* referenced by mutex in the locked state with the calling thread as */
/* its owner. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* mutex Address of the mutex */
/* timespec Pointer to timespec structure which */
/* holds timeout period in clock ticks */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* tx_thread_identify Get calling thread's pointer */
-/* tx_mutex_get ThreadX Mutex Service */
/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* tx_thread_identify Get calling thread's pointer */
+/* tx_mutex_get ThreadX Mutex Service */
+/* */
+/* CALLED BY */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_mutex_timedlock(pthread_mutex_t *mutex, struct timespec *abs_timeout)
diff --git a/utility/rtos_compatibility_layers/posix/px_mx_trylock.c b/utility/rtos_compatibility_layers/posix/px_mx_trylock.c
index 3f10c5a7..b4ec642b 100644
--- a/utility/rtos_compatibility_layers/posix/px_mx_trylock.c
+++ b/utility/rtos_compatibility_layers/posix/px_mx_trylock.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,48 +27,42 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_mutex_trylock PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_mutex_trylock PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function shall be equivalent to pthread_mutex_lock(), except */
/* that if the mutex object referenced by mutex is currently locked */
/* (by any thread,including the current thread), the call shall return */
/* immediately. If the mutex type is PTHREAD_MUTEX_RECURSIVE and the */
/* mutex is currently owned by the calling thread,the mutex lock count */
/* shall be incremented by one and the pthread_mutex_trylock()function */
-/* shall immediately return success. */
+/* shall immediately return success. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* mutex Pointer to the mutex object */
-/* */
-/* OUTPUT */
-/* */
-/* 0 If successful */
-/* Value In case of any error */
-/* */
-/* CALLS */
-/* */
-/* tx_mutex_get ThreadX Mutex get service. */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* OUTPUT */
+/* */
+/* 0 If successful */
+/* Value In case of any error */
+/* */
+/* CALLS */
+/* */
+/* tx_mutex_get ThreadX Mutex get service. */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_mutex_trylock(pthread_mutex_t *mutex)
@@ -81,13 +76,13 @@ INT retval,status;
/* Try to get the mutex */
status = tx_mutex_get( mutex_ptr, TX_NO_WAIT);
-
+
switch ( status)
{
case TX_SUCCESS:
retval = OK;
break;
-
+
case TX_DELETED:
posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
diff --git a/utility/rtos_compatibility_layers/posix/px_mx_unlock.c b/utility/rtos_compatibility_layers/posix/px_mx_unlock.c
index 0f0b7504..eb5a730f 100644
--- a/utility/rtos_compatibility_layers/posix/px_mx_unlock.c
+++ b/utility/rtos_compatibility_layers/posix/px_mx_unlock.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,18 +27,18 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_mutex_unlock PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_mutex_unlock PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function shall release the mutex object referenced by mutex. */
/* The manner in which a mutex is released is dependent upon the mutex */
/* type attribute. If there are threads blocked on the mutex object */
@@ -45,33 +46,27 @@
/* in the mutex becoming available,the scheduling policy shall */
/* determine which thread shall acquire the mutex. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* mutex Address of the mutex */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* tx_mutex_put ThreadX Mutex service */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* tx_mutex_put ThreadX Mutex service */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_mutex_unlock(pthread_mutex_t *mutex )
{
-
+
TX_MUTEX *mutex_ptr;
INT retval,status;
@@ -84,7 +79,7 @@ INT retval,status;
case TX_SUCCESS:
retval = OK;
break;
-
+
case TX_MUTEX_ERROR:
posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
diff --git a/utility/rtos_compatibility_layers/posix/px_nanosleep.c b/utility/rtos_compatibility_layers/posix/px_nanosleep.c
index 1460c5cb..6d09e71f 100644
--- a/utility/rtos_compatibility_layers/posix/px_nanosleep.c
+++ b/utility/rtos_compatibility_layers/posix/px_nanosleep.c
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -68,14 +69,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* 10-31-2022 Scott Larson Fix bounds check, */
-/* resulting in version 6.2.0 */
-/* */
/**************************************************************************/
INT nanosleep(struct timespec *req, struct timespec *rem)
{
@@ -91,7 +84,7 @@ ULONG timer_ticks;
return(ERROR);
}
- /* Add padding of 1 so that the thread will sleep no less than the specified time,
+ /* Add padding of 1 so that the thread will sleep no less than the specified time,
except in the case that timer_ticks is ULONG_MAX */
if(timer_ticks != ULONG_MAX)
{
@@ -100,7 +93,7 @@ ULONG timer_ticks;
/* Now call ThreadX thread sleep service. */
tx_thread_sleep(timer_ticks);
-
+
/* Sleep completed. */
if (rem)
{
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_attr_destroy.c b/utility/rtos_compatibility_layers/posix/px_pth_attr_destroy.c
index b11fc26c..133f64e1 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_attr_destroy.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_attr_destroy.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,49 +27,43 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_attr_destroy PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_attr_destroy PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function destroys a pthread attributes object and allows the */
/* system to reclaim any resources associated with that pthread */
/* attributes object.This doesn't have an effect on any threads created*/
/* using this pthread attributes object. */
-/* */
-/* */
-/* INPUT */
+/* */
+/* */
+/* INPUT */
/* */
/* attr Address of the pthread attributes */
-/* object to be destroyed. */
-/* */
-/* OUTPUT */
-/* */
-/* 0 If successful */
+/* object to be destroyed. */
+/* */
+/* OUTPUT */
+/* */
+/* 0 If successful */
/* Value In case of any error or the results */
/* of referencing the object after it */
-/* has been destroyed. */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* has been destroyed. */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_attr_destroy(pthread_attr_t *attr)
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_attr_getdetachstate.c b/utility/rtos_compatibility_layers/posix/px_pth_attr_getdetachstate.c
index ed6fa3e6..a52464f4 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_attr_getdetachstate.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_attr_getdetachstate.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,52 +27,46 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_attr_getdetachstate PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_attr_getdetachstate PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function returns the detach state attribute from a pthread */
/* attributes object specified.The detach state of a thread indicates */
/* whether the system is allowed to free thread resources when the */
/* thread terminates. */
/* The detach state specifies one of: */
-/* PTHREAD_CREATE_DETACHED or PTHREAD_CREATE_JOINABLE. */
+/* PTHREAD_CREATE_DETACHED or PTHREAD_CREATE_JOINABLE. */
/* The default detach state (DEFAULT_DETACHSTATE) is: */
/* PTHREAD_CREATE_JOINABLE. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Address of the thread attributes */
/* detachstate Address of variable to contain the */
-/* returned detach state */
-/* */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* returned detach state */
+/* */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_attr_getdetachstate( pthread_attr_t *attr,INT *detachstate)
@@ -83,7 +78,7 @@ INT pthread_attr_getdetachstate( pthread_attr_t *attr,INT *detachstate)
posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
- }
+ }
else
{
*detachstate = attr->detach_state ;
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_attr_getinheritsched.c b/utility/rtos_compatibility_layers/posix/px_pth_attr_getinheritsched.c
index 336e1317..db1b1622 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_attr_getinheritsched.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_attr_getinheritsched.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,18 +27,18 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_attr_getinheritsched PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_attr_getinheritsched PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function returns the inheritsched attribute from the thread */
/* attributes object specified.The inheritsched attribute will be one */
/* of PTHREAD_EXPLICIT_SCHED or PTHREAD_INHERIT_SCHED. */
@@ -47,31 +48,25 @@
/* scheduling attributes when creating new threads. */
/* */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Address of the thread attributes */
/* inheritsched Address of variable to contain the */
-/* returned inheritsched attribute */
-/* */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* returned inheritsched attribute */
+/* */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_attr_getinheritsched(pthread_attr_t *attr, INT *inheritsched)
@@ -82,7 +77,7 @@ INT pthread_attr_getinheritsched(pthread_attr_t *attr, INT *inheritsched)
posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
- }
+ }
else
{
*inheritsched = attr->inherit_sched ;
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_attr_getschedparam.c b/utility/rtos_compatibility_layers/posix/px_pth_attr_getschedparam.c
index 6fee2683..722a3178 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_attr_getschedparam.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_attr_getschedparam.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,47 +27,41 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_attr_getschedparam PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_attr_getschedparam PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function returns the scheduling parameters attribute from the */
/* pthread attributes object. */
/* */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Address of the thread attributes */
/* sched_param Address of structure to contain the */
-/* returned scheduling parameters */
-/* */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* returned scheduling parameters */
+/* */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_attr_getschedparam(pthread_attr_t *attr,struct sched_param *param)
@@ -77,7 +72,7 @@ INT pthread_attr_getschedparam(pthread_attr_t *attr,struct sched_param *param)
posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
- }
+ }
else
{
param->sched_priority = attr->sched_attr.sched_priority;
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_attr_getschedpolicy.c b/utility/rtos_compatibility_layers/posix/px_pth_attr_getschedpolicy.c
index 1d752762..de0d6610 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_attr_getschedpolicy.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_attr_getschedpolicy.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -25,47 +26,41 @@
#include "pthread.h" /* Posix API */
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_attr_getschedpolicy PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_attr_getschedpolicy PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function returns the scheduling policy from the pthread */
/* attributes object. */
/* */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Address of the thread attributes */
/* policy Address of variable to contain the */
-/* returned scheduling policy */
-/* */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* returned scheduling policy */
+/* */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_attr_getschedpolicy(pthread_attr_t *attr, INT *policy)
@@ -76,7 +71,7 @@ INT pthread_attr_getschedpolicy(pthread_attr_t *attr, INT *policy)
posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
- }
+ }
else
{
*policy = attr->sched_policy;
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_attr_getstack.c b/utility/rtos_compatibility_layers/posix/px_pth_attr_getstack.c
index 728c5380..44ac5058 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_attr_getstack.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_attr_getstack.c
@@ -1,17 +1,18 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -25,51 +26,45 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_attr_getstack PORTABLE C */
-/* 6.1.7 */
-/* AUTHOR */
-/* */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_attr_getstack PORTABLE C */
+/* 6.1.7 */
+/* AUTHOR */
+/* */
/* William E. Lamie, Microsoft Corporation */
-/* */
-/* DESCRIPTION */
-/* */
+/* */
+/* DESCRIPTION */
+/* */
/* This function gets the thread creation stack attributes stackaddr */
/* and stacksize in the attr object. */
/* The stack attributes specify the area of storage to be used for the*/
/* created thread's stack. The base (lowest addressable byte) of the */
/* storage shall be stackaddr , and the size of the storage shall be */
-/* stacksize bytes. */
+/* stacksize bytes. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Address of the thread attributes */
/* stackaddr Pointer to hold Address of stack */
-/* stacksize Holds the stack size */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
-/**************************************************************************/
+/* stacksize Holds the stack size */
+/* */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
+/* */
+/**************************************************************************/
INT pthread_attr_getstack( pthread_attr_t *attr,void **stackaddr,
size_t *stacksize)
{
@@ -79,7 +74,7 @@ INT pthread_attr_getstack( pthread_attr_t *attr,void **stackaddr,
posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
- }
+ }
else
{
*stackaddr = attr->stack_address;
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_attr_getstackaddr.c b/utility/rtos_compatibility_layers/posix/px_pth_attr_getstackaddr.c
index b8c1345e..56c5769c 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_attr_getstackaddr.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_attr_getstackaddr.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -25,46 +26,40 @@
#include "pthread.h" /* Posix API */
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_attr_getstackaddr PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_attr_getstackaddr PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function returns the stack address associated with a pthread */
-/* attributes */
+/* attributes */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Address of the thread attributes */
/* stackaddr Address of variable to contain the */
-/* returned stack address */
-/* */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* returned stack address */
+/* */
+/* */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_attr_getstackaddr( pthread_attr_t *attr,void **stackaddr)
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_attr_getstacksize.c b/utility/rtos_compatibility_layers/posix/px_pth_attr_getstacksize.c
index b25633b8..9f650e8a 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_attr_getstacksize.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_attr_getstacksize.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,47 +27,41 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_attr_getstacksize PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_attr_getstacksize PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function returns the stack size associated with a pthread */
/* The stacksize is the minimum stack size (in bytes) allocated for */
/* the created threads stack. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Address of the thread attributes */
/* stacksize Address of variable to contain the */
-/* returned stack size */
-/* */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* returned stack size */
+/* */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_attr_getstacksize(pthread_attr_t *attr, size_t *stacksize)
@@ -78,7 +73,7 @@ INT pthread_attr_getstacksize(pthread_attr_t *attr, size_t *stacksize)
posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
- }
+ }
else
{
*stacksize = attr->stack_size;
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_attr_init.c b/utility/rtos_compatibility_layers/posix/px_pth_attr_init.c
index 8bdb6d16..d2a1113c 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_attr_init.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_attr_init.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,45 +27,39 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_attr_init PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_attr_init PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function initializes a pthread attributes object to default */
/* values,if the object is already created this call will reinitialize */
-/* it else it will create a new attr object and initializes it. */
+/* it else it will create a new attr object and initializes it. */
/* */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Address of the thread attributes */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
+/* */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
/* set_default_pthread_attr to reset with defualt parameters */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_attr_init(pthread_attr_t *attr)
@@ -73,7 +68,7 @@ INT pthread_attr_init(pthread_attr_t *attr)
TX_INTERRUPT_SAVE_AREA
TX_DISABLE
-
+
/* Check this attributes object exists ? */
if (attr->inuse == TX_FALSE)
attr->inuse = TX_TRUE;
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_attr_setdetachstate.c b/utility/rtos_compatibility_layers/posix/px_pth_attr_setdetachstate.c
index 7ebc3bb6..a6c902cb 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_attr_setdetachstate.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_attr_setdetachstate.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,51 +27,45 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_attr_setdetachstate PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_attr_setdetachstate PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function sets the detach state attribute from a pthread */
/* attributes object specified.The detach state of a thread indicates */
/* whether the system is allowed to free thread resources when the */
/* thread terminates. */
/* The detach state specifies one of: */
-/* PTHREAD_CREATE_DETACHED or PTHREAD_CREATE_JOINABLE. */
+/* PTHREAD_CREATE_DETACHED or PTHREAD_CREATE_JOINABLE. */
/* The default detach state (DEFAULT_DETACHSTATE) is: */
/* PTHREAD_CREATE_JOINABLE. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Address of the thread attributes */
-/* detachstate detach state to set */
-/* */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* detachstate detach state to set */
+/* */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
@@ -82,7 +77,7 @@ INT pthread_attr_setdetachstate(pthread_attr_t *attr,INT detachstate)
posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
- }
+ }
else
{
attr->detach_state = detachstate ;
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_attr_setinheritsched.c b/utility/rtos_compatibility_layers/posix/px_pth_attr_setinheritsched.c
index 7d2f6980..466daf36 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_attr_setinheritsched.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_attr_setinheritsched.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -25,18 +26,18 @@
#include "pthread.h" /* Posix API */
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_attr_setinheritsched PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_attr_setinheritsched PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function sets the inheritsched attribute from the thread */
/* attributes object specified.The inheritsched attribute will be one */
/* of PTHREAD_EXPLICIT_SCHED or PTHREAD_INHERIT_SCHED. */
@@ -46,30 +47,24 @@
/* scheduling attributes when creating new threads. */
/* */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Address of the thread attributes */
/* inheritsched inheritsched attribute to set */
-/* */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_attr_setinheritsched(pthread_attr_t *attr, INT inheritsched)
@@ -80,7 +75,7 @@ INT pthread_attr_setinheritsched(pthread_attr_t *attr, INT inheritsched)
posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
- }
+ }
else
{
attr->inherit_sched = inheritsched ;
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_attr_setschedparam.c b/utility/rtos_compatibility_layers/posix/px_pth_attr_setschedparam.c
index ecc0e8de..7b2ed9e6 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_attr_setschedparam.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_attr_setschedparam.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,18 +27,18 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_attr_setschedparam PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_attr_setschedparam PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function sets the scheduling parameters attribute for the */
/* pthread attributes object. */
/* */
@@ -46,27 +47,21 @@
/* */
/* attr Address of the thread attributes */
/* sched_param Address of structure containing the */
-/* scheduling parameters to set */
-/* */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* scheduling parameters to set */
+/* */
+/* */
+/* OUTPUT */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_attr_setschedparam(pthread_attr_t *attr,struct sched_param *param)
@@ -77,7 +72,7 @@ INT pthread_attr_setschedparam(pthread_attr_t *attr,struct sched_param *param)
posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
- }
+ }
if (param->sched_priority == 0)
{
posix_errno = EINVAL;
@@ -88,7 +83,7 @@ INT pthread_attr_setschedparam(pthread_attr_t *attr,struct sched_param *param)
{
attr->sched_attr.sched_priority = param->sched_priority;
- }
+ }
return(OK);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_attr_setschedpolicyl.c b/utility/rtos_compatibility_layers/posix/px_pth_attr_setschedpolicyl.c
index cde63a7c..01b27ed7 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_attr_setschedpolicyl.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_attr_setschedpolicyl.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -25,47 +26,41 @@
#include "pthread.h" /* Posix API */
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_attr_setschedpolicy PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_attr_setschedpolicy PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function sets the scheduling policy from the pthread */
/* attributes object. */
/* */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Address of the thread attributes */
/* policy variable holding the scheduling */
-/* policy to set */
-/* */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* policy to set */
+/* */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_attr_setschedpolicy(pthread_attr_t *attr, INT policy)
@@ -76,7 +71,7 @@ INT pthread_attr_setschedpolicy(pthread_attr_t *attr, INT policy)
posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
- }
+ }
else
{
attr->sched_policy = policy;
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_attr_setstack.c b/utility/rtos_compatibility_layers/posix/px_pth_attr_setstack.c
index 31c92b7f..def00736 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_attr_setstack.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_attr_setstack.c
@@ -1,17 +1,18 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -25,51 +26,45 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_attr_setstack PORTABLE C */
-/* 6.1.7 */
-/* AUTHOR */
-/* */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_attr_setstack PORTABLE C */
+/* 6.1.7 */
+/* AUTHOR */
+/* */
/* William E. Lamie, Microsoft Corporation */
-/* */
-/* DESCRIPTION */
-/* */
+/* */
+/* DESCRIPTION */
+/* */
/* This function sets the thread creation stack attributes stackaddr */
/* and stacksize in the attr object. */
/* The stack attributes specify the area of storage to be used for the*/
/* created thread�s stack. The base (lowest addressable byte) of */
/* the storage shall be stackaddr , and the size of the storage shall */
-/* be stacksize bytes. */
+/* be stacksize bytes. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Address of the thread attributes */
/* stackaddr Address of stack */
-/* stacksize Holds the stack size */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
-/**************************************************************************/
+/* stacksize Holds the stack size */
+/* */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
+/* */
+/**************************************************************************/
INT pthread_attr_setstack( pthread_attr_t *attr,void *stackaddr,
size_t stacksize)
{
@@ -85,5 +80,5 @@ INT pthread_attr_setstack( pthread_attr_t *attr,void *stackaddr,
attr->stack_address = stackaddr; /* This has got no effect */
attr->stack_size = stacksize;
return(OK);
- }
+ }
}
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_attr_setstackaddr.c b/utility/rtos_compatibility_layers/posix/px_pth_attr_setstackaddr.c
index 533bc4a1..9e58e627 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_attr_setstackaddr.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_attr_setstackaddr.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,45 +27,39 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_attr_setstackaddr PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_attr_setstackaddr PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function sets the stack address associated with a pthread */
-/* attributes */
+/* attributes */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Address of the thread attributes */
/* stackaddr Address of variable to contain the */
-/* stack address to set */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* stack address to set */
+/* */
+/* OUTPUT */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_attr_setstackaddr(pthread_attr_t *attr,void *stackaddr)
@@ -76,7 +71,7 @@ INT pthread_attr_setstackaddr(pthread_attr_t *attr,void *stackaddr)
posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
- }
+ }
else
{
attr->stack_address = stackaddr;
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_attr_setstacksize.c b/utility/rtos_compatibility_layers/posix/px_pth_attr_setstacksize.c
index 66eda7a1..e63d19cf 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_attr_setstacksize.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_attr_setstacksize.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,46 +27,40 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_attr_setstacksize PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_attr_setstacksize PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function sets the stack size associated with a pthread attr */
/* The stacksize is the minimum stack size (in bytes) allocated for */
/* the created threads stack. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* attr Address of the thread attributes */
/* stacksize stack size */
-/* */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_cancel.c b/utility/rtos_compatibility_layers/posix/px_pth_cancel.c
index 7e0c7a52..faaed386 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_cancel.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_cancel.c
@@ -1,17 +1,18 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -61,12 +62,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
INT pthread_cancel(pthread_t thread)
{
@@ -74,12 +69,12 @@ INT pthread_cancel(pthread_t thread)
TX_THREAD *thread_ptr;
POSIX_TCB *pthread_ptr;
-
-
-
- /* Get the thread identifier of the pthread to be canceled */
- thread_ptr = posix_tid2thread(thread);
-
+
+
+
+ /* Get the thread identifier of the pthread to be canceled */
+ thread_ptr = posix_tid2thread(thread);
+
if( (thread_ptr->tx_thread_state == TX_COMPLETED) || (thread_ptr->tx_thread_state == TX_TERMINATED) )
{
posix_errno = EINVAL;
@@ -103,9 +98,9 @@ POSIX_TCB *pthread_ptr;
}
else if(pthread_ptr->cancel_type==PTHREAD_CANCEL_ASYNCHRONOUS )
{
- /* Signal the housekeeping ThreadX thread to cancel (delete) the requested pthread now */
+ /* Signal the housekeeping ThreadX thread to cancel (delete) the requested pthread now */
- posix_destroy_pthread(pthread_ptr,(VOID *)0);
+ posix_destroy_pthread(pthread_ptr,(VOID *)0);
}
else /* illegal value in pthread_ptr->cancel_type */
{
@@ -114,6 +109,6 @@ POSIX_TCB *pthread_ptr;
return(EINVAL);
}
- /* Indicate success. */
- return(OK);
+ /* Indicate success. */
+ return(OK);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_create.c b/utility/rtos_compatibility_layers/posix/px_pth_create.c
index a6322414..4f5f9095 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_create.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_create.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -72,15 +73,15 @@
/* or the system-imposed limit on */
/* the number of pthreads in */
/* a process PTHREAD_THREADS_MAX */
-/* would be exceeded. */
+/* would be exceeded. */
/* [EINVAL] value specified by attr is */
/* invalid. */
/* [EPERM] The caller does not have */
/* appropriate permission to set */
/* the required scheduling */
-/* parameters or scheduling policy*/
-/* */
-/* This call will not return an error code of [EINTR]*/
+/* parameters or scheduling policy*/
+/* */
+/* This call will not return an error code of [EINTR]*/
/* */
/* */
/* CALLS */
@@ -93,29 +94,20 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* 10-31-2022 Scott Larson Add 64-bit support, */
-/* remove double parenthesis, */
-/* resulting in version 6.2.0 */
-/* */
/**************************************************************************/
INT pthread_create (pthread_t *thread, pthread_attr_t *attr,
void *(*start_routine)(void*),void *arg)
-{
+{
TX_INTERRUPT_SAVE_AREA
TX_THREAD *thread_ptr;
-POSIX_TCB *pthread_ptr, *current_thread_ptr;
+POSIX_TCB *pthread_ptr, *current_thread_ptr;
INT status,retval;
-
+
/* Make sure we're calling this routine from a thread context. */
if (!posix_in_thread_context())
{
@@ -123,7 +115,7 @@ INT status,retval;
posix_internal_error(444);
}
- /* Disable interrupts. */
+ /* Disable interrupts. */
/* check for any pthread_t attr suggested */
@@ -136,25 +128,25 @@ INT status,retval;
{
/* Check attributes passed , check for validity */
if ( (attr->inuse) == TX_FALSE)
- {
+ {
/* attributes passed are not valid, return with an error */
- posix_errno = EINVAL;
+ posix_errno = EINVAL;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
}
}
- /* Get a pthread control block for this new pthread */
+ /* Get a pthread control block for this new pthread */
TX_DISABLE
- status = posix_allocate_pthread_t(&pthread_ptr);
+ status = posix_allocate_pthread_t(&pthread_ptr);
TX_RESTORE
- /* Make sure we got a Thread control block */
+ /* Make sure we got a Thread control block */
if ((status == ERROR) || (!pthread_ptr))
{
- /* Configuration/resource error. */
- return(EAGAIN);
- }
+ /* Configuration/resource error. */
+ return(EAGAIN);
+ }
if(attr->inherit_sched==PTHREAD_INHERIT_SCHED)
{
@@ -187,17 +179,17 @@ INT status,retval;
}
/* Now set up pthread initial parameters */
-
+
pthread_ptr->entry_parameter = arg;
pthread_ptr->start_routine = start_routine;
/* Newly created pthread not joined by anybody! */
pthread_ptr->is_joined_by = TX_FALSE;
pthread_ptr->joined_by_pthreadID =TX_FALSE;
- /* Newly created pthread not yet joined to any other pthread */
- pthread_ptr->is_joined_to = TX_FALSE;
+ /* Newly created pthread not yet joined to any other pthread */
+ pthread_ptr->is_joined_to = TX_FALSE;
pthread_ptr->joined_to_pthreadID = TX_FALSE;
-
-
+
+
/* Allow cancel */
pthread_ptr->cancel_state = PTHREAD_CANCEL_ENABLE;
pthread_ptr->cancel_type = PTHREAD_CANCEL_DEFERRED;
@@ -215,18 +207,18 @@ INT status,retval;
/* problem allocating stack space */
if (status == ERROR)
{
- /* Configuration/resource error. */
- return(EAGAIN);
+ /* Configuration/resource error. */
+ return(EAGAIN);
}
-
+
}
/* Create an event flags group for sigwait. */
retval = tx_event_flags_create(&(pthread_ptr -> signals.signal_event_flags), "posix sigwait events");
-
- /* Get the thread info from the TCB. */
- thread_ptr = posix_tcb2thread(pthread_ptr);
-
+
+ /* Get the thread info from the TCB. */
+ thread_ptr = posix_tcb2thread(pthread_ptr);
+
/* Now actually create and start the thread. */
/* convert Posix priorities to Threadx priority */
retval += tx_thread_create(thread_ptr,
@@ -238,27 +230,27 @@ INT status,retval;
(TX_LOWEST_PRIORITY - pthread_ptr->current_priority + 1),
(TX_LOWEST_PRIORITY - pthread_ptr->threshold + 1),
pthread_ptr->time_slice,
- TX_AUTO_START);
-
+ TX_AUTO_START);
+
TX_THREAD_EXTENSION_PTR_SET(thread_ptr, pthread_ptr)
-
- /* See if ThreadX encountered an error */
+
+ /* See if ThreadX encountered an error */
if (retval)
{
- /* Internal error */
- posix_error_handler(3333);
- retval = EACCES;
+ /* Internal error */
+ posix_error_handler(3333);
+ retval = EACCES;
}
else
{
- /* Everything is fine. */
+ /* Everything is fine. */
/* create a pthreadID by type casting POSIX_TCB into pthread_t */
pthread_ptr->pthreadID = (pthread_t )pthread_ptr;
*thread = pthread_ptr->pthreadID ;
- retval = OK;
+ retval = OK;
}
-
- /* Everything worked fine if we got here */
- return(retval);
+
+ /* Everything worked fine if we got here */
+ return(retval);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_detach.c b/utility/rtos_compatibility_layers/posix/px_pth_detach.c
index 67569584..5f25a98c 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_detach.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_detach.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -48,11 +49,11 @@
/* Eventually, you should call pthread_join() or pthread_detach() for */
/* every thread that is created joinable (with a detachstate of */
/* PTHREAD_CREATE_JOINABLE)so that the system can reclaim all resources*/
-/* associated with the thread. Failure to join to or detach joinable */
+/* associated with the thread. Failure to join to or detach joinable */
/* threads will result in memory and other resource leaks until the */
/* process ends. If thread doesn't represent a valid undetached thread,*/
-/* pthread_detach() will return ESRCH. */
-/* */
+/* pthread_detach() will return ESRCH. */
+/* */
/* */
/* INPUT */
/* */
@@ -71,12 +72,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
INT pthread_detach(pthread_t thread)
@@ -100,7 +95,7 @@ POSIX_TCB *pthread_ptr;
return (EINVAL);
}
pthread_ptr->is_detached = TX_TRUE;
-
+
TX_RESTORE
return(OK);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_equal.c b/utility/rtos_compatibility_layers/posix/px_pth_equal.c
index 314c3981..26397606 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_equal.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_equal.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -41,7 +42,7 @@
/* */
/* This function compares two pthread handles for equality. */
/* */
-/* */
+/* */
/* */
/* INPUT */
/* */
@@ -53,7 +54,7 @@
/* 0 The pthread handles do not refer to the */
/* same thread */
/* 1 The pthread handles refer to the same */
-/* thread */
+/* thread */
/* */
/* CALLS */
/* */
@@ -62,12 +63,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
INT pthread_equal(pthread_t thread1, pthread_t thread2)
{
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_exit.c b/utility/rtos_compatibility_layers/posix/px_pth_exit.c
index a072777e..d25a8ac0 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_exit.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_exit.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -48,9 +49,9 @@
/* at which time an implicit call to exit() occurs). */
/* The pthread_exit() function provides an interface similar to exit()*/
/* but on a per-thread basis. */
-/* */
-/* pthread_exit() does not return. */
-/* */
+/* */
+/* pthread_exit() does not return. */
+/* */
/* */
/* INPUT */
/* value_ptr exit parameter */
@@ -66,12 +67,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
VOID pthread_exit(void *value_ptr)
{
@@ -79,15 +74,15 @@ VOID pthread_exit(void *value_ptr)
TX_THREAD *thread_ptr;
POSIX_TCB *pthread_ptr;
- /* Get the thread identifier of the currently running thread */
- thread_ptr = tx_thread_identify();
+ /* Get the thread identifier of the currently running thread */
+ thread_ptr = tx_thread_identify();
/* get posix TCB for this pthread */
pthread_ptr = (POSIX_TCB *)thread_ptr;
-
- /* Signal the housekeeping ThreadX thread to delete the requested pthread */
- posix_destroy_pthread(pthread_ptr,value_ptr);
- /* Indicate success. */
- return;
+ /* Signal the housekeeping ThreadX thread to delete the requested pthread */
+ posix_destroy_pthread(pthread_ptr,value_ptr);
+
+ /* Indicate success. */
+ return;
}
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_getcanceltype.c b/utility/rtos_compatibility_layers/posix/px_pth_getcanceltype.c
index bec5c512..63362e2b 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_getcanceltype.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_getcanceltype.c
@@ -1,16 +1,17 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -24,17 +25,17 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_getcanceltype PORTABLE C */
-/* 6.1.7 */
-/* AUTHOR */
-/* */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_getcanceltype PORTABLE C */
+/* 6.1.7 */
+/* AUTHOR */
+/* */
/* William E. Lamie, Microsoft Corporation */
-/* */
-/* DESCRIPTION */
+/* */
+/* DESCRIPTION */
/* */
/* The pthread_fetcancelstate()function shall atomically both get the */
/* calling thread�s cancelability type to the indicated type and */
@@ -42,31 +43,25 @@
/* by oldtype. Legal values for type are PTHREAD_CANCEL_DEFERRED and */
/* PTHREAD_CANCEL_ASYNCHRONOUS. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* type New cancelability type to be set */
/* oldtype Pointer to old cancelability type */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
-/**************************************************************************/
+/* */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
+/* */
+/**************************************************************************/
INT pthread_getcanceltype (INT type, INT *oldtype)
{
TX_INTERRUPT_SAVE_AREA
@@ -75,12 +70,12 @@ TX_THREAD *thread_ptr;
POSIX_TCB *pthread_ptr;
/* First check for validity of the new cancel type to be set */
- if ( ( type == PTHREAD_CANCEL_DEFERRED ) || ( type == PTHREAD_CANCEL_ASYNCHRONOUS ) )
+ if ( ( type == PTHREAD_CANCEL_DEFERRED ) || ( type == PTHREAD_CANCEL_ASYNCHRONOUS ) )
{
TX_DISABLE
- /* Get the thread identifier of the currently running thread */
- thread_ptr = tx_thread_identify();
+ /* Get the thread identifier of the currently running thread */
+ thread_ptr = tx_thread_identify();
/* get posix TCB for this pthread */
pthread_ptr = (POSIX_TCB *)thread_ptr;
*oldtype = pthread_ptr->cancel_type;
@@ -96,4 +91,4 @@ POSIX_TCB *pthread_ptr;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
}
-}
+}
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_getschedparam.c b/utility/rtos_compatibility_layers/posix/px_pth_getschedparam.c
index b0b0c920..b21345b5 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_getschedparam.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_getschedparam.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,48 +27,42 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_getschedparam PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_getschedparam PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function returns the scheduling parameters attribute from the */
/* pthread TCB. */
/* */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* thread POSIX thread ID */
/* policy Address of the scheduling policy */
/* sched_param Address of structure to contain the */
-/* returned scheduling parameters */
-/* */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* returned scheduling parameters */
+/* */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_getschedparam(pthread_t thread, INT *policy, struct sched_param *param)
@@ -81,7 +76,7 @@ INT pthread_getschedparam(pthread_t thread, INT *policy, struct sched_param *par
if(thread_tcb==NULL)
{
return(ESRCH);
- }
+ }
else
{
*policy=thread_tcb->sched_policy;
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_init.c b/utility/rtos_compatibility_layers/posix/px_pth_init.c
index 2a35474b..5d2f36ad 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_init.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_init.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -43,16 +44,16 @@
/* */
/* DESCRIPTION */
/* */
-/* Verify that the control block belongs to a POSIX thread and not */
-/* a ThreadX thread */
+/* Verify that the control block belongs to a POSIX thread and not */
+/* a ThreadX thread */
/* */
/* INPUT */
/* */
-/* thread_ptr Pointer to a thread control block */
+/* thread_ptr Pointer to a thread control block */
/* */
/* OUTPUT */
/* */
-/* TX_FALSE if not POSIX thread. TX_TRUE if POSIX thread. */
+/* TX_FALSE if not POSIX thread. TX_TRUE if POSIX thread. */
/* */
/* CALLS */
/* */
@@ -62,58 +63,52 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
static INT is_posix_thread(TX_THREAD *thread_ptr)
{
if (((POSIX_TCB *)thread_ptr < ptcb_pool) ||
((POSIX_TCB *)thread_ptr > &ptcb_pool[PTHREAD_THREADS_MAX - 1]))
{
- return TX_FALSE;
+ return TX_FALSE;
}
- return TX_TRUE;
+ return TX_TRUE;
}
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* posix_pthread_init PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* posix_pthread_init PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
-/* This function sets up / configures / initializes all the */
-/* pthread Control Blocks that we define at compile-time in order to */
-/* ensure that there is sufficient memory. */
-/* */
-/* INPUT */
-/* */
-/* None */
-/* */
-/* OUTPUT */
-/* */
-/* None */
-/* */
-/* CALLS */
-/* */
-/* posix_reset_pthread_t Reset a task control block */
-/* */
-/* CALLED BY */
-/* */
-/* Start-up code */
-/* */
-/* RELEASE HISTORY */
-/* */
+/* DESCRIPTION */
+/* */
+/* This function sets up / configures / initializes all the */
+/* pthread Control Blocks that we define at compile-time in order to */
+/* ensure that there is sufficient memory. */
+/* */
+/* INPUT */
+/* */
+/* None */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* posix_reset_pthread_t Reset a task control block */
+/* */
+/* CALLED BY */
+/* */
+/* Start-up code */
+/* */
+/* RELEASE HISTORY */
+/* */
/* DATE NAME DESCRIPTION */
/* */
/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
@@ -122,47 +117,47 @@ static INT is_posix_thread(TX_THREAD *thread_ptr)
VOID posix_pthread_init(VOID)
{
-ULONG index;
+ULONG index;
- /* Loop through array of TCBs and initialize each one. */
+ /* Loop through array of TCBs and initialize each one. */
for (index = 0; index < PTHREAD_THREADS_MAX; index++)
{
- posix_reset_pthread_t(&(ptcb_pool[index]));
+ posix_reset_pthread_t(&(ptcb_pool[index]));
}
}
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* posix_reset_pthread_t PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* posix_reset_pthread_t PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
-/* This function resets a pthread w/ default information. */
-/* */
-/* INPUT */
-/* */
-/* ptcb pthread control block pointer */
-/* */
-/* OUTPUT */
-/* */
-/* None */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Start-up code */
-/* */
-/* RELEASE HISTORY */
-/* */
+/* DESCRIPTION */
+/* */
+/* This function resets a pthread w/ default information. */
+/* */
+/* INPUT */
+/* */
+/* ptcb pthread control block pointer */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Start-up code */
+/* */
+/* RELEASE HISTORY */
+/* */
/* DATE NAME DESCRIPTION */
/* */
/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
@@ -170,44 +165,44 @@ ULONG index;
/**************************************************************************/
VOID posix_reset_pthread_t (POSIX_TCB *ptcb)
{
- /* Indicate this entry is not in use. */
- ptcb->in_use = TX_FALSE;
+ /* Indicate this entry is not in use. */
+ ptcb->in_use = TX_FALSE;
}
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* posix_copy_pthread_attr PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* posix_copy_pthread_attr PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function copies pthread attributes from a pthread_attr object */
-/* to a pthread TCB */
-/* */
-/* INPUT */
-/* */
-/* attr pthread attr object pointer */
-/* pthread_ptr target pthread TCB */
-/* */
-/* OUTPUT */
-/* */
-/* None */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Start-up code */
-/* */
-/* RELEASE HISTORY */
-/* */
+/* to a pthread TCB */
+/* */
+/* INPUT */
+/* */
+/* attr pthread attr object pointer */
+/* pthread_ptr target pthread TCB */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Start-up code */
+/* */
+/* RELEASE HISTORY */
+/* */
/* DATE NAME DESCRIPTION */
/* */
/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
@@ -219,50 +214,50 @@ ULONG index;
pthread_ptr->current_priority = attr->sched_attr.sched_priority ;
pthread_ptr->detach_state = attr->detach_state ;
pthread_ptr->inherit_sched = attr->inherit_sched ;
- pthread_ptr->orig_priority = attr->sched_attr.sched_priority ;
+ pthread_ptr->orig_priority = attr->sched_attr.sched_priority ;
pthread_ptr->sched_attr.sched_priority= attr->sched_attr.sched_priority ;
pthread_ptr->pthread_flags = attr->pthread_flags ;
pthread_ptr->sched_policy = attr->sched_policy;
pthread_ptr->stack_size = attr->stack_size ;
pthread_ptr->stack_address = attr->stack_address;
-
+
return;
}
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* posix_allocate_pthread_t PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* posix_allocate_pthread_t PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
-/* This function attempts to allocate memory for a pthread stack and */
-/* a POSIX pthread Control Block (PTCB). */
-/* */
-/* INPUT */
-/* */
-/* stack_size Requested task stack size */
-/* tcb_ptr Pointer to tcb pointer */
-/* */
-/* OUTPUT */
-/* */
-/* Completion Status */
-/* */
-/* CALLS */
-/* */
-/* Nothing */
-/* */
-/* CALLED BY */
-/* */
-/* POSIX internal code */
-/* */
-/* RELEASE HISTORY */
-/* */
+/* DESCRIPTION */
+/* */
+/* This function attempts to allocate memory for a pthread stack and */
+/* a POSIX pthread Control Block (PTCB). */
+/* */
+/* INPUT */
+/* */
+/* stack_size Requested task stack size */
+/* tcb_ptr Pointer to tcb pointer */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* Nothing */
+/* */
+/* CALLED BY */
+/* */
+/* POSIX internal code */
+/* */
+/* RELEASE HISTORY */
+/* */
/* DATE NAME DESCRIPTION */
/* */
/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
@@ -271,84 +266,84 @@ ULONG index;
INT posix_allocate_pthread_t(POSIX_TCB **ptcb_ptr)
{
-POSIX_TCB *ptcb;
-ULONG index;
+POSIX_TCB *ptcb;
+ULONG index;
- /* Assume the worst. */
- *ptcb_ptr = (POSIX_TCB *)0;
+ /* Assume the worst. */
+ *ptcb_ptr = (POSIX_TCB *)0;
- /* This next search is optimized for simplicity, not speed. */
- for (index = 0, ptcb = ptcb_pool;
- index < PTHREAD_THREADS_MAX;
+ /* This next search is optimized for simplicity, not speed. */
+ for (index = 0, ptcb = ptcb_pool;
+ index < PTHREAD_THREADS_MAX;
index++, ptcb++)
{
- /* Is this guy in use? If not, we can use it. */
+ /* Is this guy in use? If not, we can use it. */
if (ptcb->in_use == TX_FALSE)
{
- /* This pTCB is now in use. */
- ptcb->in_use = TX_TRUE;
+ /* This pTCB is now in use. */
+ ptcb->in_use = TX_TRUE;
- /* Stop searching. */
- break;
+ /* Stop searching. */
+ break;
}
- } /* for each POSIX Thread Control Block */
+ } /* for each POSIX Thread Control Block */
- /* Did we search all pTCBs and come up empty? */
+ /* Did we search all pTCBs and come up empty? */
if (index == PTHREAD_THREADS_MAX)
{
- /* No more pTCBs available - user configuration error. */
- return(ERROR);
+ /* No more pTCBs available - user configuration error. */
+ return(ERROR);
}
else
{
/* Make sure the signal handler information is cleared when the new TCB is allocated. */
memset(&(ptcb -> signals), 0, sizeof(signal_info));
-
- /* Found one. */
- *ptcb_ptr = ptcb;
+
+ /* Found one. */
+ *ptcb_ptr = ptcb;
}
return(OK);
}
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* posix_thread_wrapper PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* posix_thread_wrapper PORTABLE C */
/* 6.2.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
-/* Every thread that is modeling a ThreadX thread has this routine as */
+/* DESCRIPTION */
+/* */
+/* Every thread that is modeling a ThreadX thread has this routine as */
/* its entry point.This routine simply calls the pthread entry routine */
-/* with its sole argument passed in pthread-create(). */
-/* */
-/* The main purpose of this function is to mimic the pthread interface */
-/* which allows 1 argument to be passed to the entry point of a thread */
-/* */
-/* INPUT */
-/* */
-/* pthread_ptr pthread control block pointer */
-/* */
-/* OUTPUT */
-/* */
-/* None */
-/* */
-/* CALLS */
-/* */
-/* *(pthread_start_routine) Application pthread entry */
-/* */
-/* CALLED BY */
-/* */
-/* POSIX only (internal) */
-/* */
-/* RELEASE HISTORY */
-/* */
+/* with its sole argument passed in pthread-create(). */
+/* */
+/* The main purpose of this function is to mimic the pthread interface */
+/* which allows 1 argument to be passed to the entry point of a thread */
+/* */
+/* INPUT */
+/* */
+/* pthread_ptr pthread control block pointer */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* *(pthread_start_routine) Application pthread entry */
+/* */
+/* CALLED BY */
+/* */
+/* POSIX only (internal) */
+/* */
+/* RELEASE HISTORY */
+/* */
/* DATE NAME DESCRIPTION */
/* */
/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
@@ -365,48 +360,48 @@ VOID *value_ptr;
/* The input argument is really a pointer to the pthread's control block */
TX_THREAD_EXTENSION_PTR_GET(pthread_ptr, POSIX_TCB, pthr_ptr)
- /* Invoke the pthread start routine with appropriate arguments */
+ /* Invoke the pthread start routine with appropriate arguments */
value_ptr = (pthread_ptr->start_routine)((VOID *)pthread_ptr->entry_parameter);
-
- /* In ThreadX, when a thread returns from its entry point, it enters the */
- /* "completed" state, which is basically an infinite suspension. */
+
+ /* In ThreadX, when a thread returns from its entry point, it enters the */
+ /* "completed" state, which is basically an infinite suspension. */
/* now use pthread_exit call to end this pthread */
pthread_exit(value_ptr);
}
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* posix_thread2tcb PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* posix_thread2tcb PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
-/* This function converts a ThreadX thread identifier into */
-/* a posix pthread control block (TCB) */
-/* */
-/* INPUT */
-/* */
-/* thread_ptr Thread pointer */
-/* */
-/* OUTPUT */
-/* */
-/* pthread pthread Task control block */
-/* */
-/* CALLS */
-/* */
-/* posix_internal_error Internal error */
-/* */
-/* CALLED BY */
-/* */
-/* posix internal code */
-/* */
-/* RELEASE HISTORY */
-/* */
+/* DESCRIPTION */
+/* */
+/* This function converts a ThreadX thread identifier into */
+/* a posix pthread control block (TCB) */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Thread pointer */
+/* */
+/* OUTPUT */
+/* */
+/* pthread pthread Task control block */
+/* */
+/* CALLS */
+/* */
+/* posix_internal_error Internal error */
+/* */
+/* CALLED BY */
+/* */
+/* posix internal code */
+/* */
+/* RELEASE HISTORY */
+/* */
/* DATE NAME DESCRIPTION */
/* */
/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
@@ -415,62 +410,62 @@ VOID *value_ptr;
POSIX_TCB *posix_thread2tcb(TX_THREAD *thread_ptr)
{
-POSIX_TCB *p_tcb;
+POSIX_TCB *p_tcb;
- /* Make sure we were called from a thread. */
+ /* Make sure we were called from a thread. */
if (!thread_ptr)
{
- /* Not called from a thread - error! */
- posix_internal_error(333);
+ /* Not called from a thread - error! */
+ posix_internal_error(333);
}
- /* Make sure thread is a POSIX thread else following case is illegal. */
+ /* Make sure thread is a POSIX thread else following case is illegal. */
if (!is_posix_thread(thread_ptr)) {
- /* Not called from a POSIX thread - error! */
- return NULL;
+ /* Not called from a POSIX thread - error! */
+ return NULL;
}
/* We can do this because the Thread information is intentionally */
/* located as the first field in the structure. */
- p_tcb = (POSIX_TCB *)thread_ptr;
+ p_tcb = (POSIX_TCB *)thread_ptr;
- /* All done. */
- return(p_tcb);
+ /* All done. */
+ return(p_tcb);
}
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* posix_tcb2thread PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* posix_tcb2thread PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
-/* This function converts a POSIX TCB into ThreadX thread */
-/* */
-/* */
-/* INPUT */
-/* */
-/* pthread_ptr pthread TCB */
-/* */
-/* OUTPUT */
-/* */
-/* thread ThreadX thread */
-/* */
-/* CALLS */
-/* */
-/* posix_internal_error Internal error */
-/* */
-/* CALLED BY */
-/* */
-/* posix internal code */
-/* */
-/* RELEASE HISTORY */
-/* */
+/* DESCRIPTION */
+/* */
+/* This function converts a POSIX TCB into ThreadX thread */
+/* */
+/* */
+/* INPUT */
+/* */
+/* pthread_ptr pthread TCB */
+/* */
+/* OUTPUT */
+/* */
+/* thread ThreadX thread */
+/* */
+/* CALLS */
+/* */
+/* posix_internal_error Internal error */
+/* */
+/* CALLED BY */
+/* */
+/* posix internal code */
+/* */
+/* RELEASE HISTORY */
+/* */
/* DATE NAME DESCRIPTION */
/* */
/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
@@ -479,55 +474,55 @@ POSIX_TCB *p_tcb;
TX_THREAD *posix_tcb2thread (POSIX_TCB *pthread_ptr)
{
-TX_THREAD *thread;
+TX_THREAD *thread;
- /* Make sure we don't have a NULL pointer. */
+ /* Make sure we don't have a NULL pointer. */
if (pthread_ptr)
{
- /* Simply convert the TCB to a Thread via a cast */
- thread = (&(pthread_ptr->thread_info ));
+ /* Simply convert the TCB to a Thread via a cast */
+ thread = (&(pthread_ptr->thread_info ));
}
else
{
- thread = ((TX_THREAD *)0);
+ thread = ((TX_THREAD *)0);
}
- return(thread);
+ return(thread);
}
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* posix_thread2tid PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* posix_thread2tid PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
-/* This function converts a ThreadX thread identifier into */
-/* posix thread ID */
-/* */
-/* INPUT */
-/* */
-/* thread_ptr Thread pointer */
-/* */
-/* OUTPUT */
-/* */
-/* thread_ID thread_ID */
-/* */
-/* CALLS */
-/* */
-/* posix_internal_error Internal error */
-/* */
-/* CALLED BY */
-/* */
-/* posix internal code */
-/* */
-/* RELEASE HISTORY */
-/* */
+/* DESCRIPTION */
+/* */
+/* This function converts a ThreadX thread identifier into */
+/* posix thread ID */
+/* */
+/* INPUT */
+/* */
+/* thread_ptr Thread pointer */
+/* */
+/* OUTPUT */
+/* */
+/* thread_ID thread_ID */
+/* */
+/* CALLS */
+/* */
+/* posix_internal_error Internal error */
+/* */
+/* CALLED BY */
+/* */
+/* posix internal code */
+/* */
+/* RELEASE HISTORY */
+/* */
/* DATE NAME DESCRIPTION */
/* */
/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
@@ -539,54 +534,54 @@ TX_THREAD *thread;
pthread_t thread_ID;
POSIX_TCB *p_tcb;
- /* Make sure we were called from a thread. */
+ /* Make sure we were called from a thread. */
if (!thread_ptr)
{
- /* Not called from a thread - error! */
- posix_internal_error(222);
+ /* Not called from a thread - error! */
+ posix_internal_error(222);
}
/* Get the TCB for this pthread */
p_tcb = posix_thread2tcb(thread_ptr);
- thread_ID = p_tcb->pthreadID;
+ thread_ID = p_tcb->pthreadID;
- /* All done. */
- return(thread_ID);
+ /* All done. */
+ return(thread_ID);
}
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* posix_tid2thread PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* posix_tid2thread PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
-/* This function converts a posix thread ID into a thread. */
-/* */
-/* INPUT */
-/* */
-/* tid Thread ID */
-/* */
-/* OUTPUT */
-/* */
-/* thread_ptr Thread pointer */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* posix internal code */
-/* */
-/* RELEASE HISTORY */
-/* */
+/* DESCRIPTION */
+/* */
+/* This function converts a posix thread ID into a thread. */
+/* */
+/* INPUT */
+/* */
+/* tid Thread ID */
+/* */
+/* OUTPUT */
+/* */
+/* thread_ptr Thread pointer */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* posix internal code */
+/* */
+/* RELEASE HISTORY */
+/* */
/* DATE NAME DESCRIPTION */
/* */
/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
@@ -595,56 +590,56 @@ POSIX_TCB *p_tcb;
TX_THREAD *posix_tid2thread(pthread_t ptid)
{
-TX_THREAD *thread;
+TX_THREAD *thread;
POSIX_TCB *pthread;
- /* Make sure we don't have a NULL TID. */
+ /* Make sure we don't have a NULL TID. */
if (ptid)
{
- /* convert the pthread ID to a pThread TCB */
+ /* convert the pthread ID to a pThread TCB */
pthread = posix_tid2tcb(ptid);
- /* convert the pthread TCB to a pThread TCB */
+ /* convert the pthread TCB to a pThread TCB */
thread= posix_tcb2thread(pthread);
}
else
{
- thread = ((TX_THREAD *)0);
+ thread = ((TX_THREAD *)0);
}
- return(thread);
+ return(thread);
}
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* posix_tid2tcb PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* posix_tid2tcb PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
-/* This function converts a posix thread ID into a posix pthread TCB */
-/* */
-/* INPUT */
-/* */
-/* tid Thread ID */
-/* */
-/* OUTPUT */
-/* */
-/* pthread_ptr pthread pointer */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* posix internal code */
-/* */
-/* RELEASE HISTORY */
-/* */
+/* DESCRIPTION */
+/* */
+/* This function converts a posix thread ID into a posix pthread TCB */
+/* */
+/* INPUT */
+/* */
+/* tid Thread ID */
+/* */
+/* OUTPUT */
+/* */
+/* pthread_ptr pthread pointer */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* posix internal code */
+/* */
+/* RELEASE HISTORY */
+/* */
/* DATE NAME DESCRIPTION */
/* */
/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
@@ -655,52 +650,52 @@ POSIX_TCB *pthread;
POSIX_TCB *pthread;
- /* Make sure we don't have a NULL TID. */
+ /* Make sure we don't have a NULL TID. */
if (ptid)
- /* Simply convert the thread ID to a pthread TCB via a cast */
- pthread = (POSIX_TCB *)ptid;
+ /* Simply convert the thread ID to a pthread TCB via a cast */
+ pthread = (POSIX_TCB *)ptid;
else
pthread = ((POSIX_TCB *)0);
-
- return(pthread);
+
+ return(pthread);
}
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* posix_destroy_pthread PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* posix_destroy_pthread PORTABLE C */
/* 6.2.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
-/* This function performs internal cleanup and housekeeping */
-/* when a pthread exits. */
-/* */
-/* INPUT */
-/* */
+/* DESCRIPTION */
+/* */
+/* This function performs internal cleanup and housekeeping */
+/* when a pthread exits. */
+/* */
+/* INPUT */
+/* */
/* pthread_ptr pointer to TCB of the pthread */
-/* to be deleted */
-/* */
-/* OUTPUT */
-/* */
+/* to be deleted */
+/* */
+/* OUTPUT */
+/* */
/* OK If successful */
-/* ERROR If fails */
-/* */
-/* CALLS */
-/* */
-/* tx_queue_send Send to system mgr queue */
-/* posix_internal_error Internal error handling */
-/* */
-/* CALLED BY */
-/* */
-/* posix internal code */
-/* */
-/* RELEASE HISTORY */
-/* */
+/* ERROR If fails */
+/* */
+/* CALLS */
+/* */
+/* tx_queue_send Send to system mgr queue */
+/* posix_internal_error Internal error handling */
+/* */
+/* CALLED BY */
+/* */
+/* posix internal code */
+/* */
+/* RELEASE HISTORY */
+/* */
/* DATE NAME DESCRIPTION */
/* */
/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
@@ -714,7 +709,7 @@ POSIX_TCB *pthread;
ULONG request[WORK_REQ_SIZE];
UINT status;
- /* Build the request. */
+ /* Build the request. */
#ifdef TX_64_BIT
request[0] = (ULONG)((ALIGN_TYPE)pthread_ptr >> 32);
@@ -727,59 +722,59 @@ UINT status;
#endif
/* Send a message to the SysMgr supervisor thread, asking it to delete */
- /* the pthread. Since the SysMgr supervisor thread is the highest */
- /* possible priority, this routine will be preempted when we */
- /* post the message to the SysMgr's work queue. */
-
- status = tx_queue_send(&posix_work_queue, request, TX_NO_WAIT);
- /* This should always succeed. */
+ /* the pthread. Since the SysMgr supervisor thread is the highest */
+ /* possible priority, this routine will be preempted when we */
+ /* post the message to the SysMgr's work queue. */
+
+ status = tx_queue_send(&posix_work_queue, request, TX_NO_WAIT);
+ /* This should always succeed. */
if (status != TX_SUCCESS)
{
- posix_internal_error(1001);
+ posix_internal_error(1001);
}
-
+
/* Return the pthread's TCB to the pool of available TCB's. */
posix_reset_pthread_t(pthread_ptr);
}
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* posix_do_pthread_delete PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* posix_do_pthread_delete PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
-/* This function deletes the pthread and reclaims the stack memory. */
-/* Also it resumes any pthread joined to this exiting pthread. */
-/* */
-/* INPUT */
-/* */
+/* DESCRIPTION */
+/* */
+/* This function deletes the pthread and reclaims the stack memory. */
+/* Also it resumes any pthread joined to this exiting pthread. */
+/* */
+/* INPUT */
+/* */
/* pthread_ptr pointer to TCB of the pthread */
-/* to be deleted */
-/* */
-/* OUTPUT */
-/* */
+/* to be deleted */
+/* */
+/* OUTPUT */
+/* */
/* OK If successful */
-/* ERROR If fails */
-/* */
-/* CALLS */
-/* */
-/* tx_thread_terminate Terminate ThreadX thread */
-/* tx_thread_delete Delete the ThreadX thread */
-/* posix_memory_release Release the task's stack */
-/* posix_free_tcb Free pthread control block */
-/* */
-/* CALLED BY */
-/* */
-/* posix internal code */
-/* */
-/* RELEASE HISTORY */
-/* */
+/* ERROR If fails */
+/* */
+/* CALLS */
+/* */
+/* tx_thread_terminate Terminate ThreadX thread */
+/* tx_thread_delete Delete the ThreadX thread */
+/* posix_memory_release Release the task's stack */
+/* posix_free_tcb Free pthread control block */
+/* */
+/* CALLED BY */
+/* */
+/* posix internal code */
+/* */
+/* RELEASE HISTORY */
+/* */
/* DATE NAME DESCRIPTION */
/* */
/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
@@ -792,45 +787,45 @@ TX_INTERRUPT_SAVE_AREA
POSIX_TCB *joined_pthread_ptr;
TX_THREAD *thread_ptr,*thread1_ptr;
-pthread_t joined_pthread_ID;
-ULONG status;
+pthread_t joined_pthread_ID;
+ULONG status;
TX_DISABLE
/* preserve the thread's return value regardless */
pthread_ptr->value_ptr = value_ptr;
-
+
if ( pthread_ptr->is_joined_by == TX_TRUE)
{
joined_pthread_ID = pthread_ptr->joined_by_pthreadID ;
joined_pthread_ptr = posix_tid2tcb(joined_pthread_ID);
-
+
joined_pthread_ptr->is_joined_to = TX_FALSE;
joined_pthread_ptr->joined_to_pthreadID =TX_FALSE;
-
+
thread_ptr = (TX_THREAD *)joined_pthread_ptr;
-
+
/* Now resume the suspended pthread joined to this pthread */
tx_thread_resume(thread_ptr);
- }
+ }
/* Terminate the pthread's ThreadX thread. */
thread1_ptr = posix_tcb2thread(pthread_ptr);
- status = tx_thread_terminate(thread1_ptr);
+ status = tx_thread_terminate(thread1_ptr);
if (status != TX_SUCCESS)
{
- posix_internal_error(2244);
+ posix_internal_error(2244);
}
-
- /* Delete the pthread's ThreadX thread. */
- status = tx_thread_delete(&(pthread_ptr->thread_info));
+
+ /* Delete the pthread's ThreadX thread. */
+ status = tx_thread_delete(&(pthread_ptr->thread_info));
if (status != TX_SUCCESS)
{
- posix_internal_error(2255);
+ posix_internal_error(2255);
}
/* Free the memory allocated for pthread's stack allocated from the posix heap */
/* if the memory was not from the posix heap this call has no effect */
/* it will be the user's responsibility to manage such memory */
-
- posix_memory_release(pthread_ptr->stack_address);
+
+ posix_memory_release(pthread_ptr->stack_address);
/* Determine if this thread is NOT a signal handler thread. If this is the case,
delete the event flag group. */
@@ -841,62 +836,62 @@ ULONG status;
tx_event_flags_delete(&(pthread_ptr -> signals.signal_event_flags));
}
- /* Return the pthread's TCB to the pool of available TCB's. */
- pthread_ptr->in_use = TX_FALSE;
+ /* Return the pthread's TCB to the pool of available TCB's. */
+ pthread_ptr->in_use = TX_FALSE;
TX_RESTORE
-
- /* All done. */
- return;
+
+ /* All done. */
+ return;
}
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* posix_set_pthread_errno PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* posix_set_pthread_errno PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
-/* This function sets the pthread error number. */
-/* Each pthread has got its very own erron number. */
-/* */
-/* INPUT */
-/* */
+/* DESCRIPTION */
+/* */
+/* This function sets the pthread error number. */
+/* Each pthread has got its very own erron number. */
+/* */
+/* INPUT */
+/* */
/* errno_set error number to set */
-/* */
-/* */
-/* OUTPUT */
-/* */
+/* */
+/* */
+/* OUTPUT */
+/* */
/* OK Always return successful */
-/* */
-/* CALLS */
-/* */
-/* tx_thread_identify get calling ThreadX thread */
/* */
-/* CALLED BY */
-/* */
-/* posix internal code */
-/* */
-/* RELEASE HISTORY */
-/* */
+/* CALLS */
+/* */
+/* tx_thread_identify get calling ThreadX thread */
+/* */
+/* CALLED BY */
+/* */
+/* posix internal code */
+/* */
+/* RELEASE HISTORY */
+/* */
/* DATE NAME DESCRIPTION */
/* */
/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
/* */
/**************************************************************************/
INT posix_set_pthread_errno(ULONG errno_set)
-{
+{
TX_THREAD *thread_ptr;
POSIX_TCB *pthread_ptr;
- /* Get the thread identifier of the currently running thread */
- thread_ptr = tx_thread_identify();
+ /* Get the thread identifier of the currently running thread */
+ thread_ptr = tx_thread_identify();
/* get posix TCB for this pthread */
pthread_ptr = (POSIX_TCB *)thread_ptr;
/* Set the error number */
@@ -904,43 +899,43 @@ POSIX_TCB *pthread_ptr;
/* Always return success!*/
return(OK);
-}
+}
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* posix_get_pthread_errno PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* posix_get_pthread_errno PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
-/* This function gets the erron number for a pthread. */
-/* Each pthread has got its very own erron number. */
-/* */
-/* INPUT */
-/* */
+/* DESCRIPTION */
+/* */
+/* This function gets the erron number for a pthread. */
+/* Each pthread has got its very own erron number. */
+/* */
+/* INPUT */
+/* */
/* ptid pthread id */
-/* */
-/* */
-/* OUTPUT */
-/* */
+/* */
+/* */
+/* OUTPUT */
+/* */
/* error_number error number for the pthread */
/* ERROR In case of any error */
-/* */
-/* CALLS */
-/* */
-/* tx_thread_identify get calling ThreadX thread */
/* */
-/* CALLED BY */
-/* */
-/* posix internal code */
-/* */
-/* RELEASE HISTORY */
-/* */
+/* CALLS */
+/* */
+/* tx_thread_identify get calling ThreadX thread */
+/* */
+/* CALLED BY */
+/* */
+/* posix internal code */
+/* */
+/* RELEASE HISTORY */
+/* */
/* DATE NAME DESCRIPTION */
/* */
/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
@@ -964,7 +959,7 @@ POSIX_TCB *pthread_ptr;
error_number = pthread_ptr->perrno;
else
error_number = ERROR;
-
+
TX_RESTORE
return(error_number);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_join.c b/utility/rtos_compatibility_layers/posix/px_pth_join.c
index 10a9302e..461ab617 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_join.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_join.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -51,12 +52,12 @@
/* Eventually, you should call pthread_join() or pthread_detach() for */
/* every thread that is created joinable (with a detachstate of */
/* PTHREAD_CREATE_JOINABLE)so that the system can reclaim all resources*/
-/* associated with the thread. Failure to join to or detach joinable */
+/* associated with the thread. Failure to join to or detach joinable */
/* threads will result in memory and other resource leaks until the */
/* process ends. If thread doesn't represent a valid undetached thread,*/
-/* pthread_detach() will return ESRCH. */
-/* */
-/* Note: this function must be called from a POSIX context; if it is */
+/* pthread_detach() will return ESRCH. */
+/* */
+/* Note: this function must be called from a POSIX context; if it is */
/* called from ThreadX context an error is returned. */
/* */
/* INPUT */
@@ -77,12 +78,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
INT pthread_join(pthread_t thread, VOID **value_ptr)
@@ -93,9 +88,9 @@ INT pthread_join(pthread_t thread, VOID **value_ptr)
TX_THREAD *target_thread;
- /* Get the TCB for the currently running pthread */
+ /* Get the TCB for the currently running pthread */
current_ptr = posix_thread2tcb(tx_thread_identify());
-
+
/* Make sure that a TCB was returned. */
if (!current_ptr)
{
@@ -136,7 +131,7 @@ INT pthread_join(pthread_t thread, VOID **value_ptr)
/* but target pthread is already terminated */
/* return the return value of the terminated thread */
target_ptr = posix_tid2tcb(thread);
- if(value_ptr)*value_ptr = target_ptr->value_ptr;
+ if(value_ptr)*value_ptr = target_ptr->value_ptr;
return(OK);
}
@@ -176,9 +171,9 @@ INT pthread_join(pthread_t thread, VOID **value_ptr)
TX_RESTORE
/* Now calling pthread will suspend itself and wait till target pthread exits */
- tx_thread_suspend ( &(current_ptr->thread_info));
+ tx_thread_suspend ( &(current_ptr->thread_info));
/* target pthread exited and thus current pthread will resume now */
/* store return value if value_ptr is valid */
- if(value_ptr)*value_ptr = target_ptr->value_ptr;
+ if(value_ptr)*value_ptr = target_ptr->value_ptr;
return(OK);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_kill.c b/utility/rtos_compatibility_layers/posix/px_pth_kill.c
index b112a4b2..30bf54d6 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_kill.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_kill.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -68,15 +69,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* 10-31-2022 Scott Larson Remove double parenthesis, */
-/* update argument type, */
-/* resulting in version 6.2.0 */
-/* */
/**************************************************************************/
int pthread_kill(ALIGN_TYPE thread_id, int sig)
{
@@ -101,7 +93,7 @@ UINT retval;
/* Determine if the desired signal is valid. */
if ((sig < 0) || (sig > SIGRTMAX))
{
-
+
/* Return an error. */
posix_set_pthread_errno(EINVAL);
return(ERROR);
@@ -126,9 +118,9 @@ UINT retval;
/* See if there is a signal handler setup for this signal. */
if (!handler)
{
-
+
/* No handler, just set/clear the event flags to handle the sigwait condition. */
-
+
/* Set the event flag corresponding the signal. */
tx_event_flags_set(&(target_thread -> signals.signal_event_flags), (((ULONG) 1) << sig), TX_OR);
@@ -142,7 +134,7 @@ UINT retval;
/* Now, let's look to see if the same signal is already pending. */
if (target_thread -> signals.signal_pending.signal_set & (((unsigned long) 1) << sig))
{
-
+
/* Yes, the same signal is already pending, just return. */
return(OK);
}
@@ -150,17 +142,17 @@ UINT retval;
/* Now determine if the thread's signals are masked by pthread_sigmask. */
if (target_thread -> signals.signal_mask.signal_set & (((unsigned long) 1) << sig))
{
-
- /* Yes, simply set the pending bit so we know that the signal must be activated later when the
+
+ /* Yes, simply set the pending bit so we know that the signal must be activated later when the
signal mask for this signal is cleared. */
target_thread -> signals.signal_pending.signal_set = target_thread -> signals.signal_pending.signal_set | (((unsigned long) 1) << sig);
return(OK);
}
/* At this point we know that we need to create a new signal handler thread for processing this signal. */
-
- /* Get a pthread control block for this new signal pthread */
-
+
+ /* Get a pthread control block for this new signal pthread */
+
/* Disable interrupts for protection. */
TX_DISABLE
@@ -168,12 +160,12 @@ UINT retval;
_tx_thread_preempt_disable++;
/* Allocate a POSIX thread control block. */
- status = posix_allocate_pthread_t(&new_signal_thread);
+ status = posix_allocate_pthread_t(&new_signal_thread);
/* Restore interrupts. */
TX_RESTORE
-
- /* Make sure we got a new thread control block */
+
+ /* Make sure we got a new thread control block */
if ((status == ERROR) || (!new_signal_thread))
{
@@ -186,10 +178,10 @@ UINT retval;
/* Restore interrupts. */
TX_RESTORE
- /* Configuration/resource error. */
+ /* Configuration/resource error. */
posix_set_pthread_errno(EAGAIN);
- return(ERROR);
- }
+ return(ERROR);
+ }
/* Inherit the stack size for the new signal thread. */
new_signal_thread -> stack_size = target_thread -> stack_size ;
@@ -200,10 +192,10 @@ UINT retval;
/* problem allocating stack space */
if (status == ERROR)
{
-
+
/* Mark the previously allocated control block as available. */
new_signal_thread -> in_use = FALSE;
-
+
/* Disable interrupts. */
TX_DISABLE
@@ -213,11 +205,11 @@ UINT retval;
/* Restore interrupts. */
TX_RESTORE
- /* Configuration/resource error. */
+ /* Configuration/resource error. */
posix_set_pthread_errno(EAGAIN);
- return(ERROR);
- }
-
+ return(ERROR);
+ }
+
/* Inherit scheduling attributes from base thread. */
new_signal_thread -> current_priority = target_thread -> current_priority ;
new_signal_thread -> detach_state = target_thread -> detach_state ;
@@ -228,7 +220,7 @@ UINT retval;
new_signal_thread -> sched_policy = target_thread -> sched_policy;
new_signal_thread -> is_joined_by = TX_FALSE;
new_signal_thread -> joined_by_pthreadID = TX_FALSE;
- new_signal_thread -> is_joined_to = TX_FALSE;
+ new_signal_thread -> is_joined_to = TX_FALSE;
new_signal_thread -> joined_to_pthreadID = TX_FALSE;
new_signal_thread -> cancel_state = PTHREAD_CANCEL_ENABLE;
new_signal_thread -> cancel_type = PTHREAD_CANCEL_DEFERRED;
@@ -244,7 +236,7 @@ UINT retval;
/* Mark the new thread as a signal thread, clear signal info, and setup links. */
new_signal_thread -> signals.signal_handler = TRUE;
new_signal_thread -> signals.signal_nesting_depth = target_thread -> signals.signal_nesting_depth;
- new_signal_thread -> signals.signal_pending.signal_set = target_thread -> signals.signal_pending.signal_set;
+ new_signal_thread -> signals.signal_pending.signal_set = target_thread -> signals.signal_pending.signal_set;
new_signal_thread -> signals.saved_thread_state = ((TX_THREAD *) target_thread) -> tx_thread_state;
new_signal_thread -> signals.base_thread_ptr = target_thread;
new_signal_thread -> signals.next_signal_thread = target_thread -> signals.top_signal_thread;
@@ -262,9 +254,9 @@ UINT retval;
(TX_LOWEST_PRIORITY - new_signal_thread -> current_priority + 1),
(TX_LOWEST_PRIORITY - new_signal_thread -> current_priority + 1),
new_signal_thread -> time_slice,
- TX_AUTO_START);
+ TX_AUTO_START);
- /* See if ThreadX encountered an error */
+ /* See if ThreadX encountered an error */
if (retval)
{
@@ -273,10 +265,10 @@ UINT retval;
/* Release the stack memory. */
posix_memory_release(new_signal_thread -> stack_address);
-
+
/* Mark the previously allocated control block as available. */
new_signal_thread -> in_use = FALSE;
-
+
/* Disable interrupts. */
TX_DISABLE
@@ -286,10 +278,10 @@ UINT retval;
/* Restore interrupts. */
TX_RESTORE
- /* Internal error */
- posix_error_handler(3333);
+ /* Internal error */
+ posix_error_handler(3333);
posix_set_pthread_errno(EACCES);
- return(ERROR);
+ return(ERROR);
}
/* Disable interrupts. */
@@ -304,13 +296,13 @@ UINT retval;
/* Restore interrupts. */
TX_RESTORE
-
+
/* Suspend the base thread so that it doesn't run again until all the signals have been processed. */
tx_thread_suspend((TX_THREAD *) target_thread);
}
else if (new_signal_thread -> signals.next_signal_thread)
{
-
+
/* Restore interrupts. */
TX_RESTORE
@@ -322,7 +314,7 @@ UINT retval;
/* Check for a preemption condition. */
_tx_thread_system_preempt_check();
-
+
/* Return success! */
return(OK);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_once.c b/utility/rtos_compatibility_layers/posix/px_pth_once.c
index 8b140971..6c6288ba 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_once.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_once.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -65,12 +66,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
INT pthread_once (pthread_once_t * once_control, VOID (*init_routine) (VOID))
{
@@ -84,7 +79,7 @@ INT pthread_once (pthread_once_t * once_control, VOID (*init_routine) (VOID))
}
else
{
- if ( once_control->state==PTH_ONCE_DONE)
+ if ( once_control->state==PTH_ONCE_DONE)
{
result = 0;
}
@@ -106,7 +101,7 @@ INT pthread_once (pthread_once_t * once_control, VOID (*init_routine) (VOID))
once_control->state=PTH_ONCE_DONE;
}
- /* enable preemption */
+ /* enable preemption */
tx_thread_preemption_change( tx_thread_identify(),old_treshold, &temp);
if (once_control->state==PTH_ONCE_STARTED)
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_self.c b/utility/rtos_compatibility_layers/posix/px_pth_self.c
index d4499afb..fd876459 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_self.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_self.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -41,8 +42,8 @@
/* */
/* This function returns thread ID of the calling pthread . */
/* */
-/* */
-/* */
+/* */
+/* */
/* */
/* INPUT */
/* */
@@ -59,35 +60,29 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
pthread_t pthread_self(VOID)
{
TX_THREAD *thread_ptr;
-pthread_t thread_ID;
+pthread_t thread_ID;
- /* Get the thread identifier of the currently running thread */
- thread_ptr = tx_thread_identify();
+ /* Get the thread identifier of the currently running thread */
+ thread_ptr = tx_thread_identify();
- /* Convert thread identifier to posix thread ID */
-
- thread_ID = posix_thread2tid(thread_ptr);
+ /* Convert thread identifier to posix thread ID */
+
+ thread_ID = posix_thread2tid(thread_ptr);
/* Determine if this thread is actually the signal thread helper. */
if (((POSIX_TCB *) thread_ptr) -> signals.signal_handler)
{
-
+
/* Yes, override the thread_ID with the non-signal thread ID. */
thread_ID = (pthread_t) ((POSIX_TCB *) thread_ptr) -> signals.base_thread_ptr;
}
- /* All done. */
- return(thread_ID);
+ /* All done. */
+ return(thread_ID);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_set_default_pthread_attr.c b/utility/rtos_compatibility_layers/posix/px_pth_set_default_pthread_attr.c
index ad8d306e..b1964206 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_set_default_pthread_attr.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_set_default_pthread_attr.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -25,41 +26,35 @@
#include "pthread.h" /* Posix API */
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* set_default_pthread_attr PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* set_default_pthread_attr PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
-/* This function sets default pthread attr w/ default information. */
-/* */
-/* INPUT */
-/* */
-/* attr pthread attr object pointer */
-/* */
-/* OUTPUT */
-/* */
-/* None */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Start-up code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* DESCRIPTION */
+/* */
+/* This function sets default pthread attr w/ default information. */
+/* */
+/* INPUT */
+/* */
+/* attr pthread attr object pointer */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* Start-up code */
/* */
/**************************************************************************/
VOID set_default_pthread_attr(pthread_attr_t *attr)
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_setcancelstate.c b/utility/rtos_compatibility_layers/posix/px_pth_setcancelstate.c
index 824c0888..55d2a008 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_setcancelstate.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_setcancelstate.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,16 +27,16 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_setcancelstate PORTABLE C */
-/* 6.1.7 */
-/* AUTHOR */
-/* */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_setcancelstate PORTABLE C */
+/* 6.1.7 */
+/* AUTHOR */
+/* */
/* William E. Lamie, Microsoft Corporation */
-/* */
+/* */
/* DESCRIPTION */
/* */
/* The pthread_setcancelstate()function shall atomically both set the */
@@ -44,31 +45,25 @@
/* by oldstate.Legal values for state are PTHREAD_CANCEL_ENABLE and */
/* PTHREAD_CANCEL_DISABLE. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* state New cancelability state to be set */
/* oldstate Pointer to old cancelability state */
-/* */
-/* OUTPUT */
/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
-/**************************************************************************/
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
+/* */
+/**************************************************************************/
INT pthread_setcancelstate (INT state, INT *oldstate)
{
@@ -78,12 +73,12 @@ TX_THREAD *thread_ptr;
POSIX_TCB *pthread_ptr;
/* First check for validity of the new cancel state to be set */
- if ( (state == PTHREAD_CANCEL_ENABLE) || (state == PTHREAD_CANCEL_DISABLE) )
+ if ( (state == PTHREAD_CANCEL_ENABLE) || (state == PTHREAD_CANCEL_DISABLE) )
{
TX_DISABLE
- /* Get the thread identifier of the currently running thread */
- thread_ptr = tx_thread_identify();
+ /* Get the thread identifier of the currently running thread */
+ thread_ptr = tx_thread_identify();
/* get posix TCB for this pthread */
pthread_ptr = (POSIX_TCB *)thread_ptr;
*oldstate = pthread_ptr->cancel_state;
@@ -99,4 +94,4 @@ POSIX_TCB *pthread_ptr;
posix_set_pthread_errno(EINVAL);
return (EINVAL);
}
-}
+}
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_setcanceltype.c b/utility/rtos_compatibility_layers/posix/px_pth_setcanceltype.c
index 73fa0623..0d403a08 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_setcanceltype.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_setcanceltype.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,17 +27,17 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_setcanceltype PORTABLE C */
-/* 6.1.7 */
-/* AUTHOR */
-/* */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_setcanceltype PORTABLE C */
+/* 6.1.7 */
+/* AUTHOR */
+/* */
/* William E. Lamie, Microsoft Corporation */
-/* */
-/* DESCRIPTION */
+/* */
+/* DESCRIPTION */
/* */
/* The pthread_setcancelstate()function shall atomically both get the */
/* calling thread's cancelability type to the indicated type and */
@@ -44,31 +45,25 @@
/* by oldtype. Legal values for type are PTHREAD_CANCEL_DEFERRED and */
/* PTHREAD_CANCEL_ASYNCHRONOUS. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* type New cancelability type to be set */
/* oldtype Pointer to old cancelability type */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
-/* None */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
-/**************************************************************************/
+/* */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
+/* */
+/**************************************************************************/
INT pthread_setcanceltype (INT type, INT *oldtype)
{
TX_INTERRUPT_SAVE_AREA
@@ -77,12 +72,12 @@ TX_THREAD *thread_ptr;
POSIX_TCB *pthread_ptr;
/* First check for validity of the new cancel type to be set */
- if ( ( type == PTHREAD_CANCEL_DEFERRED ) || ( type == PTHREAD_CANCEL_ASYNCHRONOUS ) )
+ if ( ( type == PTHREAD_CANCEL_DEFERRED ) || ( type == PTHREAD_CANCEL_ASYNCHRONOUS ) )
{
TX_DISABLE
- /* Get the thread identifier of the currently running thread */
- thread_ptr = tx_thread_identify();
+ /* Get the thread identifier of the currently running thread */
+ thread_ptr = tx_thread_identify();
/* get posix TCB for this pthread */
pthread_ptr = (POSIX_TCB *)thread_ptr;
*oldtype = pthread_ptr->cancel_type;
@@ -98,4 +93,4 @@ POSIX_TCB *pthread_ptr;
posix_set_pthread_errno(EINVAL);
return(EINVAL);
}
-}
+}
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_setschedparam.c b/utility/rtos_compatibility_layers/posix/px_pth_setschedparam.c
index ec4067c1..9970b900 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_setschedparam.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_setschedparam.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,50 +27,44 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_setschedparam PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_setschedparam PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This function changes the scheduling parameters of a pthread. */
/* */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* thread POSIX thread ID */
/* policy Address of the thread attributes */
/* sched_param Address of structure to contain the */
-/* returned scheduling parameters */
-/* */
-/* */
-/* OUTPUT */
-/* */
-/* 0 if successful */
-/* Value in case of any error */
-/* */
-/* CALLS */
-/* */
+/* returned scheduling parameters */
+/* */
+/* */
+/* OUTPUT */
+/* */
+/* 0 if successful */
+/* Value in case of any error */
+/* */
+/* CALLS */
+/* */
/* posix_tid2tcb */
/* posix_tcb2thread */
/* tx_thread_priority_change */
/* */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
INT pthread_setschedparam(pthread_t thread, INT policy, const struct sched_param *param)
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_sigmask.c b/utility/rtos_compatibility_layers/posix/px_pth_sigmask.c
index 9838fda3..8957f0ae 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_sigmask.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_sigmask.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -63,15 +64,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* 10-31-2022 Scott Larson Update pthread_kill argument */
-/* cast, */
-/* resulting in version 6.2.0 */
-/* */
/**************************************************************************/
int pthread_sigmask(int how, const sigset_t *newmask, sigset_t *oldmask)
@@ -90,7 +82,7 @@ ULONG reissue_flag;
/* Check for a valid how parameter. */
if ((how != SIG_BLOCK) && (how != SIG_SETMASK) & (how != SIG_UNBLOCK))
{
-
+
/* Return an error. */
posix_set_pthread_errno(EINVAL);
return(EINVAL);
@@ -99,7 +91,7 @@ ULONG reissue_flag;
/* Check for valid signal masks. */
if ((newmask == NULL) || (oldmask == NULL))
{
-
+
/* Return an error. */
posix_set_pthread_errno(EINVAL);
return(EINVAL);
@@ -121,7 +113,7 @@ ULONG reissue_flag;
/* Determine if the current thread is a signal handler thread. */
if (base_thread -> signals.signal_handler)
{
-
+
/* Pickup target thread. */
base_thread = base_thread -> signals.base_thread_ptr;
}
@@ -132,7 +124,7 @@ ULONG reissue_flag;
/* Now process based on how the mask is to be changed. */
if (how == SIG_BLOCK)
{
-
+
/* Simply set the mask to block the signal(s). */
base_thread -> signals.signal_mask.signal_set = base_thread -> signals.signal_mask.signal_set | newmask -> signal_set;
}
@@ -145,17 +137,17 @@ ULONG reissue_flag;
/* Now modify the singal mask correspondingly. */
if (how == SIG_UNBLOCK)
{
-
+
/* Clear only the signals specified in the new signal mask. */
base_thread -> signals.signal_mask.signal_set = base_thread -> signals.signal_mask.signal_set & ~(newmask -> signal_set);
}
else
{
-
+
/* Simply set the signal mask to the new signal mask value. */
base_thread -> signals.signal_mask.signal_set = newmask -> signal_set;
}
-
+
/* Now determine if there are any signals that need to be activated. */
released_signals = blocked_signals & ~(base_thread -> signals.signal_mask.signal_set);
@@ -168,34 +160,34 @@ ULONG reissue_flag;
/* Temporarily disable preemption. */
_tx_thread_preempt_disable++;
-
+
/* Restore interrupts. */
TX_RESTORE
-
+
/* Set the reissue flag to false. */
reissue_flag = TX_FALSE;
-
+
/* Loop to process all the blocked signals. */
signal_number = 0;
while ((released_signals) && (signal_number < 32))
{
-
+
/* Determine if this signal was released. */
if (released_signals & 1)
{
-
+
/* Yes, this signal was released. We need to make it active again. */
-
+
/* Clear the pending bit so the pthread_kill call will not discard the signal (signals are not queued in this implementation). */
base_thread -> signals.signal_pending.signal_set = base_thread -> signals.signal_pending.signal_set & ~(((unsigned long) 1) << signal_number);
/* Call pthread_kill to reissue the signal. */
pthread_kill((ALIGN_TYPE) base_thread, signal_number);
-
+
/* Set the reissue flag. */
reissue_flag = TX_TRUE;
}
-
+
/* Look for next signal. */
released_signals = released_signals >> 1;
signal_number++;
@@ -206,22 +198,22 @@ ULONG reissue_flag;
/* Release preemption. */
_tx_thread_preempt_disable--;
-
+
/* Restore interrupts. */
TX_RESTORE
/* Check for a preemption condition. */
_tx_thread_system_preempt_check();
-
+
/* Determine if the reissue flag is set. */
if (reissue_flag == TX_TRUE)
{
/* Relinquish to allow signal thread at same priority to run before we return. */
- _tx_thread_relinquish();
+ _tx_thread_relinquish();
}
}
- }
+ }
/* Setup return mask. */
oldmask -> signal_set = previous_mask;
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_testcancel.c b/utility/rtos_compatibility_layers/posix/px_pth_testcancel.c
index 6e84dd32..e64729df 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_testcancel.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_testcancel.c
@@ -1,17 +1,18 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -62,29 +63,23 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
VOID pthread_testcancel(VOID)
{
POSIX_TCB *pthread_ptr;
-
- /* Get the thread identifier of the calling pthread */
- pthread_ptr = posix_tid2tcb(pthread_self());
+
+ /* Get the thread identifier of the calling pthread */
+ pthread_ptr = posix_tid2tcb(pthread_self());
/* Check if thread was created with cancel enable */
if ( (pthread_ptr->cancel_state == PTHREAD_CANCEL_ENABLE) &&
(pthread_ptr->cancel_type==PTHREAD_CANCEL_DEFERRED) &&
(pthread_ptr->cancel_request==TRUE) )
{
-
- /* Signal the housekeeping ThreadX thread to cancel (delete) this pthread */
+
+ /* Signal the housekeeping ThreadX thread to cancel (delete) this pthread */
posix_destroy_pthread(pthread_ptr,(VOID *)0);
}
}
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_yield.c b/utility/rtos_compatibility_layers/posix/px_pth_yield.c
index 20113844..a6c17278 100644
--- a/utility/rtos_compatibility_layers/posix/px_pth_yield.c
+++ b/utility/rtos_compatibility_layers/posix/px_pth_yield.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,45 +27,39 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* pthread_yield PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* pthread_yield PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This subroutine forces the calling thread to relinquish use of its */
/* processor,and to wait in the run queue before it is scheduled again.*/
/* If the run queue is empty when this subroutine is called, the */
/* calling thread is immediately rescheduled. */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* Nothing */
/* */
-/* OUTPUT */
-/* */
+/* OUTPUT */
+/* */
/* None */
/* */
-/* CALLS */
-/* */
-/* posix_internal_error posix internal error function */
+/* CALLS */
+/* */
+/* posix_internal_error posix internal error function */
/* tx_thread_relinquish ThreadX function */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
VOID pthread_yield(VOID)
diff --git a/utility/rtos_compatibility_layers/posix/px_px_initialize.c b/utility/rtos_compatibility_layers/posix/px_px_initialize.c
index 94ea3a06..0ad147a0 100644
--- a/utility/rtos_compatibility_layers/posix/px_px_initialize.c
+++ b/utility/rtos_compatibility_layers/posix/px_px_initialize.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -27,8 +28,8 @@
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -77,12 +78,6 @@
/* */
/* POSIX internal code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
static VOID posix_memory_init(VOID * posix_heap_ptr)
{
@@ -94,7 +89,7 @@ INT retval;
retval = tx_byte_pool_create((TX_BYTE_POOL *)&posix_heap_byte_pool,
"POSIX HEAP",
posix_heap_ptr,
- POSIX_HEAP_SIZE_IN_BYTES);
+ POSIX_HEAP_SIZE_IN_BYTES);
/* Make sure the byte pool was created successfully. */
if (retval)
@@ -146,11 +141,11 @@ INT retval;
static VOID posix_semaphore_init(VOID)
{
-ULONG i;
-sem_t *sem_ptr;
+ULONG i;
+sem_t *sem_ptr;
/* Start at the front of the pool. */
- sem_ptr = &(posix_sem_pool[0]);
+ sem_ptr = &(posix_sem_pool[0]);
for (i = 0; i < SEM_NSEMS_MAX; i++, sem_ptr++)
{
@@ -219,20 +214,20 @@ VOID *posix_initialize(VOID * posix_memory)
UCHAR *pointer;
- /* Setup temporary memory pointer, so we can start allocating
- space for the posix data structures. The important thing to
+ /* Setup temporary memory pointer, so we can start allocating
+ space for the posix data structures. The important thing to
remember here is that the system thread's stack, the region0
memory, and the queue are allocated sequentially from the
address specified by posix_memory. */
pointer = (UCHAR *)posix_memory;
-
- /* Start up the System Manager thread. */
+
+ /* Start up the System Manager thread. */
tx_thread_create(&posix_system_manager, "POSIX System Manager", posix_system_manager_entry,
0, pointer, POSIX_SYSTEM_STACK_SIZE,
SYSMGR_PRIORITY, SYSMGR_THRESHOLD,
- TX_NO_TIME_SLICE, TX_AUTO_START);
-
+ TX_NO_TIME_SLICE, TX_AUTO_START);
+
pointer = pointer + POSIX_SYSTEM_STACK_SIZE;
/* Set up a memory "heap" used internally by the POSIX. */
@@ -243,11 +238,11 @@ UCHAR *pointer;
/* Create the work item message queue. */
tx_queue_create(&posix_work_queue, "POSIX work queue", WORK_REQ_SIZE,
pointer, WORK_QUEUE_DEPTH*WORK_REQ_SIZE);
-
+
pointer = pointer + (WORK_QUEUE_DEPTH * WORK_REQ_SIZE);
- /* Initialize static pool of pthreads Control blocks. */
- posix_pthread_init();
+ /* Initialize static pool of pthreads Control blocks. */
+ posix_pthread_init();
/* Create a default pthread_attr */
set_default_pthread_attr(&posix_default_pthread_attr);
@@ -264,7 +259,7 @@ UCHAR *pointer;
/* Set up a pool of semaphores used internally by the POSIX. */
posix_semaphore_init();
#endif
-
+
/* Create a default mutex_attr */
set_default_mutexattr(&posix_default_mutex_attr);
diff --git a/utility/rtos_compatibility_layers/posix/px_sched_get_prio.c b/utility/rtos_compatibility_layers/posix/px_sched_get_prio.c
index af2ec4c4..253622d7 100644
--- a/utility/rtos_compatibility_layers/posix/px_sched_get_prio.c
+++ b/utility/rtos_compatibility_layers/posix/px_sched_get_prio.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -58,12 +59,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
diff --git a/utility/rtos_compatibility_layers/posix/px_sched_yield.c b/utility/rtos_compatibility_layers/posix/px_sched_yield.c
index fc2297bf..870a2572 100644
--- a/utility/rtos_compatibility_layers/posix/px_sched_yield.c
+++ b/utility/rtos_compatibility_layers/posix/px_sched_yield.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -61,12 +62,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
INT sched_yield(VOID)
{
diff --git a/utility/rtos_compatibility_layers/posix/px_sem_close.c b/utility/rtos_compatibility_layers/posix/px_sem_close.c
index c695000d..8beb79a2 100644
--- a/utility/rtos_compatibility_layers/posix/px_sem_close.c
+++ b/utility/rtos_compatibility_layers/posix/px_sem_close.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -60,12 +61,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
INT sem_close(sem_t * sem)
{
diff --git a/utility/rtos_compatibility_layers/posix/px_sem_destroy.c b/utility/rtos_compatibility_layers/posix/px_sem_destroy.c
index 7f5db2fe..8cdbe619 100644
--- a/utility/rtos_compatibility_layers/posix/px_sem_destroy.c
+++ b/utility/rtos_compatibility_layers/posix/px_sem_destroy.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -60,12 +61,6 @@
/* */
/* POSIX internal Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
INT sem_destroy(sem_t *sem)
{
@@ -76,7 +71,7 @@ INT sem_destroy(sem_t *sem)
result = EINVAL; /* general error */
}
- else
+ else
{
if(sem->sem.tx_semaphore_suspended_count > 0 ) result = EBUSY;
else result = NO_ERROR;
diff --git a/utility/rtos_compatibility_layers/posix/px_sem_find_sem.c b/utility/rtos_compatibility_layers/posix/px_sem_find_sem.c
index c8e3c85b..ada7fe37 100644
--- a/utility/rtos_compatibility_layers/posix/px_sem_find_sem.c
+++ b/utility/rtos_compatibility_layers/posix/px_sem_find_sem.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -58,14 +59,6 @@
/* */
/* POSIX internal Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* 08-02-2021 Scott Larson Removed unneeded semicolon, */
-/* resulting in version 6.1.8 */
-/* */
/**************************************************************************/
sem_t* posix_find_sem(const CHAR * name)
{
diff --git a/utility/rtos_compatibility_layers/posix/px_sem_get_new_sem.c b/utility/rtos_compatibility_layers/posix/px_sem_get_new_sem.c
index 0a7e56a0..e5e9239f 100644
--- a/utility/rtos_compatibility_layers/posix/px_sem_get_new_sem.c
+++ b/utility/rtos_compatibility_layers/posix/px_sem_get_new_sem.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -57,12 +58,6 @@
/* */
/* POSIX internal Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
TX_SEMAPHORE * posix_get_new_sem(VOID)
{
@@ -85,7 +80,7 @@ sem_t *sem_ptr;
if (sem_ptr->in_use == TX_FALSE)
{
- /* Found one! */
+ /* Found one! */
tx_sem = MAKE_TX_SEM(sem_ptr);
/* This semaphore is now in use. */
diff --git a/utility/rtos_compatibility_layers/posix/px_sem_getvalue.c b/utility/rtos_compatibility_layers/posix/px_sem_getvalue.c
index 0e751697..291c59d0 100644
--- a/utility/rtos_compatibility_layers/posix/px_sem_getvalue.c
+++ b/utility/rtos_compatibility_layers/posix/px_sem_getvalue.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -60,12 +61,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
INT sem_getvalue(sem_t * sem,ULONG * sval)
{
@@ -74,7 +69,7 @@ TX_INTERRUPT_SAVE_AREA
TX_SEMAPHORE *TheSem;
- /* get ThreadX semaphore. */
+ /* get ThreadX semaphore. */
TheSem = (TX_SEMAPHORE *)sem;
/* First, check for an invalid semaphore pointer. */
diff --git a/utility/rtos_compatibility_layers/posix/px_sem_init.c b/utility/rtos_compatibility_layers/posix/px_sem_init.c
index 48cab2ea..532491e6 100644
--- a/utility/rtos_compatibility_layers/posix/px_sem_init.c
+++ b/utility/rtos_compatibility_layers/posix/px_sem_init.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -60,12 +61,6 @@
/* */
/* POSIX internal Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
INT sem_init(sem_t *sem , INT pshared, UINT value)
{
@@ -76,7 +71,7 @@ INT sem_init(sem_t *sem , INT pshared, UINT value)
result = EINVAL; /* general error */
}
- else
+ else
{
if(tx_semaphore_create(&(sem->sem),"",value)) result = EINVAL;
else
diff --git a/utility/rtos_compatibility_layers/posix/px_sem_open.c b/utility/rtos_compatibility_layers/posix/px_sem_open.c
index 18ef1462..ad9468a8 100644
--- a/utility/rtos_compatibility_layers/posix/px_sem_open.c
+++ b/utility/rtos_compatibility_layers/posix/px_sem_open.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -64,21 +65,13 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* 10-31-2022 Scott Larson Update comparison with NULL, */
-/* resulting in version 6.2.0 */
-/* */
/**************************************************************************/
sem_t * sem_open(const CHAR * name, ULONG oflag, ...)
{
TX_INTERRUPT_SAVE_AREA
-TX_SEMAPHORE *TheSem;
+TX_SEMAPHORE *TheSem;
sem_t *semid;
ULONG retval;
ULONG len;
@@ -92,7 +85,7 @@ mode_t mode;
{
/* return POSIX error. */
posix_internal_error(444);
-
+
/* return error. */
return (( sem_t * )SEM_FAILED);
}
@@ -134,7 +127,7 @@ mode_t mode;
posix_set_pthread_errno(ENOENT);
/* Return the SEM_FAILED error. */
- return(( sem_t * )SEM_FAILED);
+ return(( sem_t * )SEM_FAILED);
}
if( (oflag == O_CREAT) || ( (oflag & (O_CREAT|O_EXCL )) == (O_CREAT|O_EXCL) ) )
{
@@ -206,7 +199,7 @@ mode_t mode;
posix_sem->refCnt = value;
/* Give the caller the semaphore ID. */
- semid = (sem_t * )TheSem;
+ semid = (sem_t * )TheSem;
/* Restore interrupts. */
TX_RESTORE
diff --git a/utility/rtos_compatibility_layers/posix/px_sem_post.c b/utility/rtos_compatibility_layers/posix/px_sem_post.c
index 0b72935d..a1164a0d 100644
--- a/utility/rtos_compatibility_layers/posix/px_sem_post.c
+++ b/utility/rtos_compatibility_layers/posix/px_sem_post.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -58,12 +59,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
INT sem_post(sem_t * sem)
{
diff --git a/utility/rtos_compatibility_layers/posix/px_sem_reset.c b/utility/rtos_compatibility_layers/posix/px_sem_reset.c
index 2a663e74..0d94e269 100644
--- a/utility/rtos_compatibility_layers/posix/px_sem_reset.c
+++ b/utility/rtos_compatibility_layers/posix/px_sem_reset.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -56,12 +57,6 @@
/* */
/* POSIX internal Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
VOID posix_sem_reset(sem_t *sem )
{
diff --git a/utility/rtos_compatibility_layers/posix/px_sem_set_sem_name.c b/utility/rtos_compatibility_layers/posix/px_sem_set_sem_name.c
index 2f40abae..f662bfca 100644
--- a/utility/rtos_compatibility_layers/posix/px_sem_set_sem_name.c
+++ b/utility/rtos_compatibility_layers/posix/px_sem_set_sem_name.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -57,12 +58,6 @@
/* */
/* POSIX internal code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
VOID posix_set_sem_name(sem_t * sem, CHAR *name)
{
diff --git a/utility/rtos_compatibility_layers/posix/px_sem_trywait.c b/utility/rtos_compatibility_layers/posix/px_sem_trywait.c
index db482a7d..04a9afeb 100644
--- a/utility/rtos_compatibility_layers/posix/px_sem_trywait.c
+++ b/utility/rtos_compatibility_layers/posix/px_sem_trywait.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -60,12 +61,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
INT sem_trywait(sem_t * sem)
{
diff --git a/utility/rtos_compatibility_layers/posix/px_sem_unlink.c b/utility/rtos_compatibility_layers/posix/px_sem_unlink.c
index 7bba322b..92ec02a0 100644
--- a/utility/rtos_compatibility_layers/posix/px_sem_unlink.c
+++ b/utility/rtos_compatibility_layers/posix/px_sem_unlink.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -60,14 +61,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* 10-31-2022 Scott Larson Remove double parenthesis, */
-/* resulting in version 6.2.0 */
-/* */
/**************************************************************************/
INT sem_unlink(const CHAR * name)
{
@@ -96,7 +89,7 @@ ULONG len;
posix_set_pthread_errno(ENOENT);
/* Return Error. */
- return(ERROR);
+ return(ERROR);
}
if(sem)
diff --git a/utility/rtos_compatibility_layers/posix/px_sem_wait.c b/utility/rtos_compatibility_layers/posix/px_sem_wait.c
index a7f510f2..f1be786d 100644
--- a/utility/rtos_compatibility_layers/posix/px_sem_wait.c
+++ b/utility/rtos_compatibility_layers/posix/px_sem_wait.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -59,12 +60,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
INT sem_wait( sem_t * sem )
{
diff --git a/utility/rtos_compatibility_layers/posix/px_sig_addset.c b/utility/rtos_compatibility_layers/posix/px_sig_addset.c
index b94db0a6..a0e657c8 100644
--- a/utility/rtos_compatibility_layers/posix/px_sig_addset.c
+++ b/utility/rtos_compatibility_layers/posix/px_sig_addset.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -59,12 +60,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
int sigaddset(sigset_t *set, int signo)
{
@@ -72,7 +67,7 @@ int sigaddset(sigset_t *set, int signo)
/* Determine if the desired signal is valid. */
if ((signo < 0) || (signo > SIGRTMAX))
{
-
+
/* Return an error. */
posix_set_pthread_errno(EINVAL);
return(ERROR);
@@ -82,5 +77,5 @@ int sigaddset(sigset_t *set, int signo)
set -> signal_set = set -> signal_set | (((ULONG) 1) << signo);
/* Return success! */
- return(OK);
+ return(OK);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_sig_delset.c b/utility/rtos_compatibility_layers/posix/px_sig_delset.c
index a2867781..eb2943d3 100644
--- a/utility/rtos_compatibility_layers/posix/px_sig_delset.c
+++ b/utility/rtos_compatibility_layers/posix/px_sig_delset.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -59,12 +60,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
int sigdelset(sigset_t *set, int signo)
{
@@ -72,7 +67,7 @@ int sigdelset(sigset_t *set, int signo)
/* Determine if the desired signal is valid. */
if ((signo < 0) || (signo > SIGRTMAX))
{
-
+
/* Return an error. */
posix_set_pthread_errno(EINVAL);
return(EINVAL);
@@ -82,5 +77,5 @@ int sigdelset(sigset_t *set, int signo)
set -> signal_set = set -> signal_set & ~(((unsigned long) 1) << signo);
/* Return success! */
- return(OK);
+ return(OK);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_sig_emptyset.c b/utility/rtos_compatibility_layers/posix/px_sig_emptyset.c
index 8cc92aa9..3bf716df 100644
--- a/utility/rtos_compatibility_layers/posix/px_sig_emptyset.c
+++ b/utility/rtos_compatibility_layers/posix/px_sig_emptyset.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -57,12 +58,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
int sigemptyset(sigset_t *set)
{
@@ -70,7 +65,7 @@ int sigemptyset(sigset_t *set)
/* Is there a pointer. */
if (!set)
{
-
+
/* Return an error. */
posix_set_pthread_errno(EINVAL);
return(ERROR);
diff --git a/utility/rtos_compatibility_layers/posix/px_sig_fillset.c b/utility/rtos_compatibility_layers/posix/px_sig_fillset.c
index 46447ff8..d769a6e8 100644
--- a/utility/rtos_compatibility_layers/posix/px_sig_fillset.c
+++ b/utility/rtos_compatibility_layers/posix/px_sig_fillset.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -58,12 +59,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
int sigfillset(sigset_t *set)
{
@@ -71,7 +66,7 @@ int sigfillset(sigset_t *set)
/* Is there a pointer. */
if (!set)
{
-
+
/* Return an error. */
posix_set_pthread_errno(EINVAL);
return(ERROR);
diff --git a/utility/rtos_compatibility_layers/posix/px_sig_signal.c b/utility/rtos_compatibility_layers/posix/px_sig_signal.c
index 7cbdd012..d086adce 100644
--- a/utility/rtos_compatibility_layers/posix/px_sig_signal.c
+++ b/utility/rtos_compatibility_layers/posix/px_sig_signal.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -61,12 +62,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
int signal(int signo, void (*func)(int))
{
@@ -85,7 +80,7 @@ POSIX_TCB *current_thread;
/* Determine if the desired signal is valid. */
if ((signo < 0) || (signo > SIGRTMAX))
{
-
+
/* Return an error. */
posix_set_pthread_errno(EINVAL);
return(ERROR);
@@ -93,10 +88,10 @@ POSIX_TCB *current_thread;
/* Now pickup the current thread pointer. */
current_thread = (POSIX_TCB *) tx_thread_identify();
-
+
/* Now index into the array of signal handlers and insert this one. */
current_thread -> signals.signal_func[signo] = func;
-
+
/* Return success! */
return(OK);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_sig_wait.c b/utility/rtos_compatibility_layers/posix/px_sig_wait.c
index 92294a73..35ea6531 100644
--- a/utility/rtos_compatibility_layers/posix/px_sig_wait.c
+++ b/utility/rtos_compatibility_layers/posix/px_sig_wait.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/**************************************************************************/
/**************************************************************************/
@@ -63,12 +64,6 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
int sigwait(const sigset_t *set, int *sig)
{
@@ -99,7 +94,7 @@ POSIX_TCB *base_thread;
/* Determine if the current thread is a signal handler thread. */
if (base_thread -> signals.signal_handler)
{
-
+
/* Pickup target thread. */
base_thread = base_thread -> signals.base_thread_ptr;
}
@@ -114,9 +109,9 @@ POSIX_TCB *base_thread;
/* Are there any. */
if (pending_signals)
{
-
+
/* Yes, there are signals being masked currently that would satisfy this request. */
-
+
/* Save the current mask. */
saved_mask = base_thread -> signals.signal_mask.signal_set;
@@ -125,31 +120,31 @@ POSIX_TCB *base_thread;
/* Call pthread_sigmask to temporarily unblock these signals which will release them as well. */
pthread_sigmask(SIG_UNBLOCK, set, &original_set);
-
+
/* Now determine if the changed mask is still in effect, i.e., there wasn't a pthread_sigmask call from any subsequent signal handlers. */
if (base_thread -> signals.signal_mask.signal_set == changed_mask)
{
-
+
/* Yes, restore the previous signal mask. */
base_thread -> signals.signal_mask.signal_set = saved_mask;
}
-
+
/* Derived the signal number from the bit map. */
TX_LOWEST_SET_BIT_CALCULATE(pending_signals, signal_number);
-
+
/* Return the signal number. */
*sig = (int) signal_number;
-
+
/* Return success! */
return(OK);
}
-
+
/* Determine if there are any signals that have to be temporarily cleared. */
if (base_thread -> signals.signal_mask.signal_set & set -> signal_set)
{
-
+
/* Yes, there are signals being masked needed to satisfy this request. */
-
+
/* Save the current mask. */
saved_mask = base_thread -> signals.signal_mask.signal_set;
@@ -159,14 +154,14 @@ POSIX_TCB *base_thread;
/* Apply the changed signal mask. */
base_thread -> signals.signal_mask.signal_set = changed_mask;
}
-
+
/* Suspend on the signal specified by the input. */
status = tx_event_flags_get(&(base_thread -> signals.signal_event_flags), (ULONG) set -> signal_set, TX_OR_CLEAR, &signal_bit_map, TX_WAIT_FOREVER);
/* Determine if we need to restore the signal mask. */
if ((saved_mask) && (changed_mask == base_thread -> signals.signal_mask.signal_set))
{
-
+
/* Yes, the signal mask should be restored. */
base_thread -> signals.signal_mask.signal_set = saved_mask;
}
@@ -174,19 +169,19 @@ POSIX_TCB *base_thread;
/* Check for successful status. */
if (status == TX_SUCCESS)
{
-
+
/* Derived the signal number from the bit map. */
TX_LOWEST_SET_BIT_CALCULATE(signal_bit_map, signal_number);
-
+
/* Return the signal number. */
*sig = (int) signal_number;
-
+
/* Return success! */
return(OK);
}
else
{
-
+
/* Return error! */
return(EINVAL);
}
diff --git a/utility/rtos_compatibility_layers/posix/px_sleep.c b/utility/rtos_compatibility_layers/posix/px_sleep.c
index 1ed878f4..87eda03e 100644
--- a/utility/rtos_compatibility_layers/posix/px_sleep.c
+++ b/utility/rtos_compatibility_layers/posix/px_sleep.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -26,49 +27,43 @@
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* sleep PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* sleep PORTABLE C */
/* 6.1.7 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
+/* DESCRIPTION */
/* */
/* This function shall cause the calling thread to be suspended from */
/* execution until either the number of realtime seconds specified by */
-/* the argument seconds has elapsed */
+/* the argument seconds has elapsed */
/* */
-/* INPUT */
+/* INPUT */
/* */
/* seconds Is the number of real-time (as opposed */
/* to CPU-time) seconds to suspend the */
/* calling thread. */
/* */
-/* OUTPUT */
-/* */
+/* OUTPUT */
+/* */
/* number of seconds remaining to sleep */
/* A nonzero value indicates sleep was */
/* interrupted. Zero is successful */
/* completion */
/* */
/* */
-/* CALLS */
+/* CALLS */
/* */
/* tx_thread_sleep ThreadX thread sleep service */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
+/* CALLED BY */
+/* */
+/* Application Code */
/* */
/**************************************************************************/
UINT sleep(ULONG seconds)
@@ -90,7 +85,7 @@ UINT temp1, temp2, diff, result;
result = ((seconds * CPU_TICKS_PER_SECOND) - diff);
}
- return (result/CPU_TICKS_PER_SECOND);
-
+ return (result/CPU_TICKS_PER_SECOND);
+
}
diff --git a/utility/rtos_compatibility_layers/posix/px_system_manager.c b/utility/rtos_compatibility_layers/posix/px_system_manager.c
index ef24202b..92b71414 100644
--- a/utility/rtos_compatibility_layers/posix/px_system_manager.c
+++ b/utility/rtos_compatibility_layers/posix/px_system_manager.c
@@ -1,18 +1,19 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-/** */
-/** POSIX wrapper for THREADX */
+/** */
+/** POSIX wrapper for THREADX */
/** */
/** */
/** */
@@ -25,46 +26,38 @@
#include "pthread.h" /* Posix API */
#include "px_int.h" /* Posix helper functions */
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* posix_system_manager_entry PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* posix_system_manager_entry PORTABLE C */
/* 6.2.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
-/* DESCRIPTION */
-/* */
+/* DESCRIPTION */
+/* */
/* This is the System Manager thread for the POSIX> The system */
/* manager thread cleans up terminated threads and releases */
/* the stack memory associated with the thread */
-/* */
-/* INPUT */
-/* */
-/* input Not used */
-/* */
-/* OUTPUT */
-/* */
-/* None */
-/* */
-/* CALLS */
/* */
-/* tx_queue_receive Receive system request */
+/* INPUT */
+/* */
+/* input Not used */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* tx_queue_receive Receive system request */
/* posix_do_pthread_delete Delete a pthread */
/* */
-/* CALLED BY */
-/* */
-/* Start-up code */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
+/* CALLED BY */
/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* 10-31-2022 Scott Larson Add 64-bit support, */
-/* resulting in version 6.2.0 */
+/* Start-up code */
/* */
/**************************************************************************/
VOID posix_system_manager_entry(ULONG input)
@@ -79,18 +72,18 @@ VOID *value_ptr;
/* Avoid compiler warning. */
TX_PARAMETER_NOT_USED(input);
- /* Loop forever, waiting for work requests. */
+ /* Loop forever, waiting for work requests. */
while(1)
{
/* Wait forever for the next work request. */
status = tx_queue_receive(&posix_work_queue, &request, TX_WAIT_FOREVER);
- /* Make sure we didn't encounter any trouble. */
+ /* Make sure we didn't encounter any trouble. */
if (status != TX_SUCCESS)
{
/* Get the next message. */
continue;
}
-
+
#ifdef TX_64_BIT
pthread_ptr = (POSIX_TCB *)((((ALIGN_TYPE)request[0]) << 32) | request[1]);
value_ptr = (VOID *)((((ALIGN_TYPE)request[2]) << 32) | request[3]);
@@ -101,7 +94,7 @@ VOID *value_ptr;
/* Delete the pthread */
posix_do_pthread_delete(pthread_ptr, value_ptr);
-
+
} /* System Manager forever loop */
}
diff --git a/utility/rtos_compatibility_layers/posix/readme_release_history.txt b/utility/rtos_compatibility_layers/posix/readme_release_history.txt
index 2eb4eaa0..fe6ea047 100644
--- a/utility/rtos_compatibility_layers/posix/readme_release_history.txt
+++ b/utility/rtos_compatibility_layers/posix/readme_release_history.txt
@@ -1,4 +1,4 @@
-
+
px_abs_time_to_rel_ticks.c Casted size_t to ULONG.
px_clock_gettime.c Casted size_t to ULONG.
@@ -12,18 +12,18 @@
tx_posix.h Reduced default object pool sizes, added posix_initialize prototype.
Improved default stack size symbol name
- px_memory_release.c When thread completes and posix_do_pthread_delete() is called,
- posix_memory_release() returns with error if stack was not
+ px_memory_release.c When thread completes and posix_do_pthread_delete() is called,
+ posix_memory_release() returns with error if stack was not
allocated from the posix pool but rather stack is a static array.
- px_mq_open.c Fixed bug to handle a NULL attribute in mq_open().
+ px_mq_open.c Fixed bug to handle a NULL attribute in mq_open().
px_pth_create.c Call to pthread_create() with pthread_attr_t set to NULL or with the
default values as set by pthread_attr_init() has unexpected behavior.
Fixed by adding code to use defaults.
- px_pth_init.c Fixed memory leak when threads are released or killed by
- calling posix_reset_pthread after posix_destroy_pthread()
+ px_pth_init.c Fixed memory leak when threads are released or killed by
+ calling posix_reset_pthread after posix_destroy_pthread()
which was not returning memory to the TCB pool
Fixed bug when trying to join threads from ThreadX context when
diff --git a/utility/rtos_compatibility_layers/posix/readme_threadx_posix.txt b/utility/rtos_compatibility_layers/posix/readme_threadx_posix.txt
index 5aeb5d52..d9321396 100644
--- a/utility/rtos_compatibility_layers/posix/readme_threadx_posix.txt
+++ b/utility/rtos_compatibility_layers/posix/readme_threadx_posix.txt
@@ -12,17 +12,17 @@ ThreadX primitives and bypasses basic ThreadX error checking.
1.1 POSIX Compliancy Wrapper Source
-The Wrapper source code is designed for simplicity and is comprised of separate source
-files for most functions. Including the supplied pthread.h file will import
+The Wrapper source code is designed for simplicity and is comprised of separate source
+files for most functions. Including the supplied pthread.h file will import
all the necessary POSIX constants and subroutine prototypes.
1.2 POSIX Compliancy Wrapper Documentation
This document itself serves as a POSIX Compliancy Wrapper User Guide by
-providing an overview of the porting process, including various caveats and
-pitfalls to watch out for. In addition, each covered POSIX call is documented,
-including information about supported/unsupported options, limitations, deviations,
+providing an overview of the porting process, including various caveats and
+pitfalls to watch out for. In addition, each covered POSIX call is documented,
+including information about supported/unsupported options, limitations, deviations,
and suggestions on how to work-around any limitations.
@@ -31,32 +31,32 @@ and suggestions on how to work-around any limitations.
The POSIX Compliancy Wrapper is easily installed by adding the
the posix library to your current application build. Make sure your application build
references the same header files as the ones the posix library has been built with.
-The file pthread.h must be included in your application source where POSIX
+The file pthread.h must be included in your application source where POSIX
calls are required.
Since the POSIX compliancy wrapper does not cover the complete standard, not all prototypes
are provided. Most notably is the header file tx_px_time.h.
2.1 Initialization
-The POSIX Compliancy Wrapper requires that a special initialization function is called
+The POSIX Compliancy Wrapper requires that a special initialization function is called
prior to accessing any POSIX calls. The function to call and its prototype is:
VOID *posix_initialize(VOID * posix_memory);
This function is usually called from the application specific ThreadX
-initialization routine, tx_application_define(). The memory pointer supplied
-to posix_initialize must be a contiguouis reserved section of memory
+initialization routine, tx_application_define(). The memory pointer supplied
+to posix_initialize must be a contiguouis reserved section of memory
that has at least the following number of bytes:
POSIX_SYSTEM_STACK_SIZE +
TX_REGION0_SIZE_IN_BYTES + /* Region0 size */
(WORK_QUEUE_DEPTH * WORK_REQ_SIZE) + /* system queue size */
- POSIX_HEAP_SIZE_IN_BYTES
+ POSIX_HEAP_SIZE_IN_BYTES
These equates are defined in tx_posix.h. The following additional equates
-define the number of POSIX objects supported by the POSIX Wrapper (default
+define the number of POSIX objects supported by the POSIX Wrapper (default
value is shown):
SEM_NSEMS_MAX 100 /* simultaneous POSIX semaphores */
@@ -77,7 +77,7 @@ value is shown):
POSIX mutexes sported. */
-The function posix_initialize will return a pointer to the next free
+The function posix_initialize will return a pointer to the next free
available memory location for the application.
@@ -119,7 +119,7 @@ INT sem_destroy(sem_t *sem);
/***********************************************************************/
INT sched_yield(VOID);
-INT pthread_create (pthread_t *thread,
+INT pthread_create (pthread_t *thread,
pthread_attr_t *attr,
VOID *(*start_routine)(VOID*),VOID *arg);
INT pthread_detach(pthread_t thread);
@@ -220,35 +220,35 @@ throughout the Wrapper, as follows:
posix_error_handler
posix_internal_error
-In general these routines are called when basic usage errors occur. These
-routines may also be used as a place to catch errors that are not detected if the
-application source is not checking the return status. The default processing for each of
+In general these routines are called when basic usage errors occur. These
+routines may also be used as a place to catch errors that are not detected if the
+application source is not checking the return status. The default processing for each of
these is a simple spin loop.
Most functions can provide an error number. The means by which each function
-provides its error numbers is specified in its description. Some functions
-provide the error number in a variable accessed through the symbol posix_errno.
-While other functions return an error number directly as the function value. Functions
-return a value of zero to indicate success. If more than one error occurs in
-processing a function call, any one of the possible errors may be returned, as the order
+provides its error numbers is specified in its description. Some functions
+provide the error number in a variable accessed through the symbol posix_errno.
+While other functions return an error number directly as the function value. Functions
+return a value of zero to indicate success. If more than one error occurs in
+processing a function call, any one of the possible errors may be returned, as the order
of detection is undefined.
Some functions may return [ENOSYS] suggesting that an attempt was made to
use a function that is not available in this implementation.
-Each pthread has its own error number, which can be obtained through a
+Each pthread has its own error number, which can be obtained through a
function call:
INT posix_get_pthread_errno(pthread_t ptid)
-This call will return the last generated error code for the pthread having
+This call will return the last generated error code for the pthread having
ptid as an ID.
5.1 POSIX Compliancy Wrapper Limitations
Due to performance and architecture issues, this POSIX Compliancy Wrapper
-does not support all the POSIX calls. A summary of the POSIX Compliancy
+does not support all the POSIX calls. A summary of the POSIX Compliancy
Wrapper limitations is as follows:
� Configuration
@@ -288,8 +288,8 @@ Following calls are implemented with some limitations:
space becomes available in that queue, the message with the highest
priority will be unblocked. THIS FEATURE IS NOT IMPLEMENTED.
- b.) If a message is sent (or received) to a queue with out opening the named
- queue, in such a case mqdes (message queue descriptor) pointer is
+ b.) If a message is sent (or received) to a queue with out opening the named
+ queue, in such a case mqdes (message queue descriptor) pointer is
invalid and may result in erratic behavior.
3.) mq_receive()
@@ -323,11 +323,11 @@ Following calls are implemented with some limitations:
7.) Thread Cancelation
pthread cancelation cleanup handlers are not supported which means
-pthread_cleanup_push( ) and pthread_cleanup_pop( ) functions are not
+pthread_cleanup_push( ) and pthread_cleanup_pop( ) functions are not
implemented.
When the pthread_cancel( ) function is called the target thread is canceled
-with immediate effect. (provided cancelability is enabled for the target
+with immediate effect. (provided cancelability is enabled for the target
pthread)
The cancelation processing in the target thread shall run asynchronously
@@ -337,7 +337,7 @@ with respect to the ailing thread returning from pthread_cancel( ).
No attributes are supported for condition variable in this implementation.
9.) pthreads suspended by nanosleep() and sleep() calls can not be awakened
-by signals, once in the suspension both these calls will complete the
+by signals, once in the suspension both these calls will complete the
suspension period.
10.) pthread_once (pthread_once_t * once_control, VOID (*init_routine) (VOID))
@@ -347,8 +347,8 @@ There is no provision if the init_routine contains a cancellation point.
6.0 Demonstration System
The file posix_demo.c contains a demonstration system that utilizes POSIX
-calls. This Demo application will demonstrate some of the basic POSIX
-calls. This demo application should be used as an example of how to integrate the POSIX
+calls. This Demo application will demonstrate some of the basic POSIX
+calls. This demo application should be used as an example of how to integrate the POSIX
Compliancy Wrapper into your application.
diff --git a/utility/rtos_compatibility_layers/posix/sched.h b/utility/rtos_compatibility_layers/posix/sched.h
index 3a150170..2f37b05c 100644
--- a/utility/rtos_compatibility_layers/posix/sched.h
+++ b/utility/rtos_compatibility_layers/posix/sched.h
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -33,20 +34,13 @@
/* This file defines the constants, structures, etc.needed to */
/* implement the Evacuation Kit for POSIX Users (POSIX) */
/* */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
#ifndef _SCHED_H
#define _SCHED_H
-struct sched_param
+struct sched_param
{
INT sched_priority;
};
diff --git a/utility/rtos_compatibility_layers/posix/signal.h b/utility/rtos_compatibility_layers/posix/signal.h
index 72722c67..0da4adea 100644
--- a/utility/rtos_compatibility_layers/posix/signal.h
+++ b/utility/rtos_compatibility_layers/posix/signal.h
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -33,23 +34,13 @@
/* This file defines the constants, structures, etc.needed to */
/* implement signals functionality for POSIX Users (POSIX) */
/* */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* 10-31-2022 Scott Larson Update pthread_kill argument */
-/* type, */
-/* resulting in version 6.2.0 */
-/* */
/**************************************************************************/
#ifndef _SIGNAL_H
#define _SIGNAL_H
-/* The POSIX wrapper for ThreadX supports a maximum of 32 signals, from 0
+/* The POSIX wrapper for ThreadX supports a maximum of 32 signals, from 0
through 31, inclusive. In this implemenation, signals are NOT queued. */
@@ -87,15 +78,15 @@ typedef struct signal_info_struct
UINT signal_handler; /* This is a flag. If TRUE, this thread is being used as a signal handler. If FALSE, it is a regular thread. */
UINT signal_nesting_depth; /* A positive value indicates the level of nested signal handling the POSIX thread is currently processing. */
- sigset_t signal_pending; /* Bit map of signals pending. */
- sigset_t signal_mask; /* Signal mask, bit blocks the signal until cleared. */
+ sigset_t signal_pending; /* Bit map of signals pending. */
+ sigset_t signal_mask; /* Signal mask, bit blocks the signal until cleared. */
UINT saved_thread_state; /* Saved ThreadX state of the POSIX thread, at the time of the first signal. */
- struct pthread_control_block *base_thread_ptr; /* Pointer to the thread associated with the signal. */
- struct pthread_control_block *top_signal_thread; /* Pointer to the top (most recent) signal thread. */
- struct pthread_control_block *next_signal_thread; /* Pointer to the next most recent signal thread. */
- void (*signal_func[MAX_SIGNALS])(int); /* Array of signal handlers for this thread. */
- TX_EVENT_FLAGS_GROUP signal_event_flags; /* ThreadX event flag group used for sigwait */
-
+ struct pthread_control_block *base_thread_ptr; /* Pointer to the thread associated with the signal. */
+ struct pthread_control_block *top_signal_thread; /* Pointer to the top (most recent) signal thread. */
+ struct pthread_control_block *next_signal_thread; /* Pointer to the next most recent signal thread. */
+ void (*signal_func[MAX_SIGNALS])(int); /* Array of signal handlers for this thread. */
+ TX_EVENT_FLAGS_GROUP signal_event_flags; /* ThreadX event flag group used for sigwait */
+
} signal_info;
diff --git a/utility/rtos_compatibility_layers/posix/time.h b/utility/rtos_compatibility_layers/posix/time.h
index 51f30be9..9fabdec5 100644
--- a/utility/rtos_compatibility_layers/posix/time.h
+++ b/utility/rtos_compatibility_layers/posix/time.h
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -34,13 +35,6 @@
/* implement time related functionality for the Evacuation Kit */
/* for POSIX Users (POSIX) */
/* */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
#ifndef _TX_PX_TIME_H
@@ -53,7 +47,7 @@ typedef ULONG time_t;
typedef INT clockid_t;
-struct timespec
+struct timespec
{
time_t tv_sec; /* time in terms of seconds */
ULONG tv_nsec; /* remaining time in terms of nano seconds*/
@@ -62,7 +56,7 @@ struct timespec
struct itimerspec
{
struct timespec it_interval ; /* Timer period. */
- struct timespec it_value; /* Timer expiration. */
+ struct timespec it_value; /* Timer expiration. */
};
#define CLOCK_REALTIME 1
diff --git a/utility/rtos_compatibility_layers/posix/tx_posix.h b/utility/rtos_compatibility_layers/posix/tx_posix.h
index 88986402..ce533dd8 100644
--- a/utility/rtos_compatibility_layers/posix/tx_posix.h
+++ b/utility/rtos_compatibility_layers/posix/tx_posix.h
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -33,16 +34,6 @@
/* This file defines the constants, structures, etc.needed to */
/* implement the Evacuation Kit for POSIX Users (POSIX) */
/* */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* 10-31-2022 Scott Larson Update WORK_REQ_SIZE value, */
-/* update pthread_t typedef, */
-/* resulting in version 6.2.0 */
-/* */
/**************************************************************************/
#ifndef TX_POSIX
@@ -84,15 +75,15 @@
#endif
*/
-/* Define the system configuration constants for the Evacuation Kit for
- POSIX Users.This is where the number of system objects
+/* Define the system configuration constants for the Evacuation Kit for
+ POSIX Users.This is where the number of system objects
(pthreads, message queues, semaphores etc.)are defined. */
/************************************************************************/
/* SYSTEM CONFIGURATION PARAMETERS */
/************************************************************************/
-/* Define the maximum number of simultaneous POSIX semaphores
+/* Define the maximum number of simultaneous POSIX semaphores
supported. */
#define SEM_NSEMS_MAX 16
@@ -103,14 +94,14 @@
#define SEM_VALUE_MAX 100
/* Define the maximum number of simultaneous POSIX message queues supported. */
-
+
#define POSIX_MAX_QUEUES 16
/* Define the maximum number of simultaneous POSIX pthreads supported. */
#define PTHREAD_THREADS_MAX 16
/* Define the maximum number of simultaneous POSIX mutexes supported. */
-
+
#define POSIX_MAX_MUTEX 16
/* Define the maximum length of name of message queue. */
@@ -131,8 +122,8 @@
/* Define number of CPU ticks per second */
-#define CPU_TICKS_PER_SECOND 100 /* assuming 10 mSec tick */
-#define NANOSECONDS_IN_CPU_TICK 10000000 /* assuming 10 mSec tick */
+#define CPU_TICKS_PER_SECOND 100 /* assuming 10 mSec tick */
+#define NANOSECONDS_IN_CPU_TICK 10000000 /* assuming 10 mSec tick */
/* Define queue control specific data definitions. */
@@ -146,7 +137,7 @@
/************************************************************************/
#define POSIX_STACK_PADDING 1024
#define POSIX_SYSTEM_STACK_SIZE 1024
-#define POSIX_PTHREAD_STACK_SIZE 1024
+#define POSIX_PTHREAD_STACK_SIZE 1024
/************************************************************************/
/* ARCHITECTURE DEFINITIONS */
@@ -172,9 +163,9 @@
#define MIN_STACKSIZE_POWERPC 2048
-/************************************************************************/
-/* MISCELLANEOUS CONSTANTS */
-/************************************************************************/
+/************************************************************************/
+/* MISCELLANEOUS CONSTANTS */
+/************************************************************************/
/* Requests/commands to SysMgr task. */
#define SYSMGR_DELETE_TASK 0
@@ -183,7 +174,7 @@
#define PTHREAD_NAME_LEN 4
#define PTHREAD_CREATE_DETACHED 1
-#define PTHREAD_CREATE_JOINABLE 0
+#define PTHREAD_CREATE_JOINABLE 0
/* scheduler related constants */
@@ -224,9 +215,9 @@ enum pth_once_state {
PTH_ONCE_CANCELLED = 0x3
};
-/************************************************************************/
-/* ERROR CODES (those defined outside of POSIX) */
-/************************************************************************/
+/************************************************************************/
+/* ERROR CODES (those defined outside of POSIX) */
+/************************************************************************/
#ifdef ERROR
#undef ERROR
@@ -277,14 +268,14 @@ typedef ULONG BOOL;
typedef struct pthread_attr_obj
{
ULONG pthread_flags;
- INT detach_state;
+ INT detach_state;
INT inherit_sched;
INT sched_policy;
struct sched_param sched_attr;
VOID *stack_address;
ULONG stack_size;
INT inuse;
-} pthread_attr_t;
+} pthread_attr_t;
typedef INT ssize_t ; /* this should be pulled in from sys\types.h */
@@ -297,24 +288,24 @@ typedef ULONG mode_t;
typedef struct pthread_control_block
{
- /* This pthread's ThreadX TCB. */
+ /* This pthread's ThreadX TCB. */
TX_THREAD thread_info;
/* This pthread's unique identifier */
pthread_t pthreadID;
/* To check if posix Pthread is in use. */
UINT in_use;
/* All pthread attributes contained in the a pthread_attr_t object */
- ULONG pthread_flags;
- INT detach_state;
+ ULONG pthread_flags;
+ INT detach_state;
INT inherit_sched;
INT sched_policy;
struct sched_param sched_attr;
VOID *stack_address;
ULONG stack_size;
INT cancel_state;
- INT cancel_type;
+ INT cancel_type;
/* Identifier of the target thread to which this pthread is joined */
- pthread_t joined_to_pthreadID;
+ pthread_t joined_to_pthreadID;
/* Identifier of the caller thread which has joined to this thread*/
pthread_t joined_by_pthreadID;
/* To check if posix pthread is joined to any other pthread */
@@ -325,16 +316,16 @@ typedef struct pthread_control_block
UINT is_detached;
/* Value returned by the terminating thread which is joined to this thread */
VOID *value_ptr;
- /* Define the original pthread priority. */
+ /* Define the original pthread priority. */
ULONG orig_priority;
- /* Define the current pthread priority. */
+ /* Define the current pthread priority. */
ULONG current_priority;
- /* Define the pthread's pre-emption threshold. */
+ /* Define the pthread's pre-emption threshold. */
ULONG threshold;
- /* Define the pthread's timeslice. */
+ /* Define the pthread's timeslice. */
ULONG time_slice;
/* specify pthread start routine */
- VOID *(*start_routine)(VOID *);
+ VOID *(*start_routine)(VOID *);
/* specify argument for start up routine */
ULONG *entry_parameter;
/* to hold error code for this pthread */
@@ -353,15 +344,15 @@ typedef struct pthread_mutex_attr_obj
INT protocol;
INT pshared;
INT in_use;
-
+
} pthread_mutexattr_t;
/* Define POSIX mutex structure. */
typedef struct pthread_mutex_control_block
{
- /* This mutex's ThreadX Control block */
- TX_MUTEX mutex_info;
+ /* This mutex's ThreadX Control block */
+ TX_MUTEX mutex_info;
/* This mutex's attributes */
INT type;
/* Is this Mutex object is in use? */
@@ -381,7 +372,7 @@ struct mq_attr
ULONG mq_msgsize;
/* Flags are ignored as these are passed separately in open(). */
ULONG mq_flags;
-};
+};
/* Define POSIX message queue structure. */
typedef struct msg_que
@@ -410,17 +401,17 @@ typedef struct msg_que
/* Define Queue Descriptor. */
typedef struct mq_des
{
- /* Queue FLAGS. */
+ /* Queue FLAGS. */
ULONG f_flag;
/* message Queue structure. */
POSIX_MSG_QUEUE * f_data;
-
+
} *mqd_t;
/* STRUCTURES RELATED TO POSIX SEMAPHORES */
-typedef struct POSIX_SEMAPHORE_STRUCT
+typedef struct POSIX_SEMAPHORE_STRUCT
{
/* ThreadX semaphore. */
TX_SEMAPHORE sem;
@@ -439,23 +430,23 @@ typedef struct POSIX_SEMAPHORE_STRUCT
} sem_t;
-typedef sem_t *SEM_ID;
+typedef sem_t *SEM_ID;
typedef struct pthread_cond_obj
{
- /* This pthread condition variable's internal counting Semaphore */
+ /* This pthread condition variable's internal counting Semaphore */
TX_SEMAPHORE cond_semaphore;
-
+
INT type;
INT in_use;
-
+
} pthread_cond_t;
typedef struct pthread_condattr_obj
{
/* INT type; */
INT in_use;
-
+
} pthread_condattr_t;
@@ -478,10 +469,10 @@ extern unsigned int posix_errno;
VOID *posix_initialize(VOID * posix_memory);
-/* Define POSIX API function prototypes. */
+/* Define POSIX API function prototypes. */
INT mq_send(mqd_t mqdes, const char * msg_ptr,
- size_t msg_len,ULONG msg_prio );
+ size_t msg_len,ULONG msg_prio );
ssize_t mq_receive(mqd_t mqdes, VOID *pMsg, size_t msgLen,
ULONG *pMsgPrio );
INT mq_unlink(const char * mqName);
@@ -497,7 +488,7 @@ INT sem_wait( sem_t * sem );
INT sem_init(sem_t *sem , INT pshared, UINT value);
INT sem_destroy(sem_t *sem);
-INT pthread_create (pthread_t *thread, pthread_attr_t *attr,
+INT pthread_create (pthread_t *thread, pthread_attr_t *attr,
VOID *(*start_routine)(VOID*),VOID *arg);
INT pthread_detach(pthread_t thread);
INT pthread_join(pthread_t thread, VOID **value_ptr);
diff --git a/utility/rtos_compatibility_layers/posix/tx_px_time.h b/utility/rtos_compatibility_layers/posix/tx_px_time.h
index fcd80338..cf0476f0 100644
--- a/utility/rtos_compatibility_layers/posix/tx_px_time.h
+++ b/utility/rtos_compatibility_layers/posix/tx_px_time.h
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present Eclipse ThreadX contributors
+ *
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -34,13 +35,6 @@
/* implement time related functionality for the Evacuation Kit */
/* for POSIX Users (POSIX) */
/* */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
-/* */
/**************************************************************************/
#ifndef _TX_PX_TIME_H
@@ -52,7 +46,7 @@ typedef ULONG time_t;
#endif
-struct timespec
+struct timespec
{
ULONG timeout_value; /* time in terms of CPU ticks */
time_t tv_sec; /* time in terms of Seconds */