diff options
Diffstat (limited to 'cpukit/posix/src')
47 files changed, 92 insertions, 97 deletions
diff --git a/cpukit/posix/src/cancel.c b/cpukit/posix/src/cancel.c index 300055d68a..68b964a384 100644 --- a/cpukit/posix/src/cancel.c +++ b/cpukit/posix/src/cancel.c @@ -12,7 +12,7 @@ * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * - * Copyright (c) 2016 embedded brains GmbH. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -75,7 +75,7 @@ int pthread_cancel( pthread_t thread ) } else { _Thread_Dispatch_disable_with_CPU( cpu_self, &lock_context ); _ISR_lock_ISR_enable( &lock_context ); - _Thread_Cancel( the_thread, executing, PTHREAD_CANCELED ); + (void) _Thread_Cancel( the_thread, executing, 0 ); _Thread_Dispatch_enable( cpu_self ); } return 0; diff --git a/cpukit/posix/src/clocknanosleep.c b/cpukit/posix/src/clocknanosleep.c index 3fa890fecd..43f15346de 100644 --- a/cpukit/posix/src/clocknanosleep.c +++ b/cpukit/posix/src/clocknanosleep.c @@ -82,6 +82,15 @@ int clock_nanosleep( rmtp = NULL; } else { absolute = false; + + /* + * A relative CLOCK_REALTIME time out shall not be affected by + * CLOCK_REALTIME changes through clock_settime(). Since our + * CLOCK_REALTIME is basically just CLOCK_MONOTONIC plus an offset, we can + * simply use the CLOCK_MONOTONIC watchdog for relative CLOCK_REALTIME time + * outs. + */ + clock_id = CLOCK_MONOTONIC; } if ( clock_id == CLOCK_REALTIME ) { @@ -118,11 +127,8 @@ int clock_nanosleep( struct timespec actual_end; struct timespec planned_end; - if ( clock_id == CLOCK_REALTIME ) { - _Timecounter_Nanotime( &actual_end ); - } else { - _Timecounter_Nanouptime( &actual_end ); - } + _Assert( clock_id == CLOCK_MONOTONIC ); + _Timecounter_Nanouptime( &actual_end ); _Watchdog_Ticks_to_timespec( executing->Timer.Watchdog.expire, diff --git a/cpukit/posix/src/condtimedwait.c b/cpukit/posix/src/condtimedwait.c index b063aac9b1..258e38a357 100644 --- a/cpukit/posix/src/condtimedwait.c +++ b/cpukit/posix/src/condtimedwait.c @@ -39,7 +39,6 @@ #endif #include <rtems/posix/condimpl.h> -#include <rtems/score/todimpl.h> /* * 11.4.4 Waiting on a Condition, P1003.1c/Draft 10, p. 105 diff --git a/cpukit/posix/src/key.c b/cpukit/posix/src/key.c index 971dc7b60b..d7551f62dd 100644 --- a/cpukit/posix/src/key.c +++ b/cpukit/posix/src/key.c @@ -9,7 +9,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (C) 2018 embedded brains GmbH + * Copyright (C) 2018 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/keycreate.c b/cpukit/posix/src/keycreate.c index 9c4b795675..59a5e5a927 100644 --- a/cpukit/posix/src/keycreate.c +++ b/cpukit/posix/src/keycreate.c @@ -11,7 +11,7 @@ /* * COPYRIGHT (c) 1989-2010. * On-Line Applications Research Corporation (OAR). - * Copyright (c) 2016 embedded brains GmbH. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/keydelete.c b/cpukit/posix/src/keydelete.c index 5677eb7500..8e4448c53f 100644 --- a/cpukit/posix/src/keydelete.c +++ b/cpukit/posix/src/keydelete.c @@ -11,7 +11,7 @@ /* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). - * Copyright (c) 2016 embedded brains GmbH. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/keygetspecific.c b/cpukit/posix/src/keygetspecific.c index b8c5d61ee8..4f0bf898ec 100644 --- a/cpukit/posix/src/keygetspecific.c +++ b/cpukit/posix/src/keygetspecific.c @@ -12,7 +12,7 @@ * Copyright (c) 2012 Zhongwei Yao. * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). - * Copyright (c) 2016 embedded brains GmbH. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/keysetspecific.c b/cpukit/posix/src/keysetspecific.c index 6f0063dd2c..4d70cc6a26 100644 --- a/cpukit/posix/src/keysetspecific.c +++ b/cpukit/posix/src/keysetspecific.c @@ -12,7 +12,7 @@ * Copyright (c) 2012 Zhongwei Yao. * COPYRIGHT (c) 1989-2014. * On-Line Applications Research Corporation (OAR). - * Copyright (c) 2016 embedded brains GmbH. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/keyzerokvp.c b/cpukit/posix/src/keyzerokvp.c index 8fe5898eb4..73fa1aa64b 100644 --- a/cpukit/posix/src/keyzerokvp.c +++ b/cpukit/posix/src/keyzerokvp.c @@ -1,7 +1,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (C) 2018 embedded brains GmbH + * Copyright (C) 2018 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/killinfo.c b/cpukit/posix/src/killinfo.c index 2765ab30ca..bde511504a 100644 --- a/cpukit/posix/src/killinfo.c +++ b/cpukit/posix/src/killinfo.c @@ -47,7 +47,6 @@ #include <rtems/posix/pthreadimpl.h> #include <rtems/posix/psignalimpl.h> #include <rtems/score/isr.h> -#include <rtems/score/schedulerimpl.h> #include <rtems/score/statesimpl.h> #include <rtems/seterr.h> @@ -324,7 +323,6 @@ int _POSIX_signals_Send( * + sigprocmask() unblocks the signal, OR * + sigaction() which changes the handler to SIG_IGN. */ - the_thread = NULL; goto post_process_signal; /* diff --git a/cpukit/posix/src/mqueue.c b/cpukit/posix/src/mqueue.c index 9cdef7596c..3b380740b7 100644 --- a/cpukit/posix/src/mqueue.c +++ b/cpukit/posix/src/mqueue.c @@ -9,7 +9,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (C) 2018 embedded brains GmbH + * Copyright (C) 2018 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/mqueueconfig.c b/cpukit/posix/src/mqueueconfig.c index c4109a716d..be7acb6a82 100644 --- a/cpukit/posix/src/mqueueconfig.c +++ b/cpukit/posix/src/mqueueconfig.c @@ -1,7 +1,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright 2018, embedded brains GmbH <rtems@embedded-brains.de> + * Copyright 2018, embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/mutexattrsetprotocol.c b/cpukit/posix/src/mutexattrsetprotocol.c index 5a6c44cf52..c3205c9a75 100644 --- a/cpukit/posix/src/mutexattrsetprotocol.c +++ b/cpukit/posix/src/mutexattrsetprotocol.c @@ -44,7 +44,6 @@ #include <rtems/score/coremuteximpl.h> #include <rtems/score/watchdog.h> #include <rtems/posix/muteximpl.h> -#include <rtems/posix/priorityimpl.h> /* * 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128 diff --git a/cpukit/posix/src/mutexunlock.c b/cpukit/posix/src/mutexunlock.c index 681aa8fd1b..0644cec188 100644 --- a/cpukit/posix/src/mutexunlock.c +++ b/cpukit/posix/src/mutexunlock.c @@ -41,8 +41,6 @@ #include <rtems/posix/muteximpl.h> #include <rtems/posix/posixapi.h> -#include <string.h> - bool _POSIX_Mutex_Auto_initialization( POSIX_Mutex_Control *the_mutex ) { unsigned long zero; diff --git a/cpukit/posix/src/pbarrierdestroy.c b/cpukit/posix/src/pbarrierdestroy.c index 089e45c4e6..3e4dd8ef47 100644 --- a/cpukit/posix/src/pbarrierdestroy.c +++ b/cpukit/posix/src/pbarrierdestroy.c @@ -11,7 +11,7 @@ * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * - * Copyright (c) 2017 embedded brains GmbH + * Copyright (c) 2017 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/pbarrierinit.c b/cpukit/posix/src/pbarrierinit.c index d50cc3ad98..d6083f4879 100644 --- a/cpukit/posix/src/pbarrierinit.c +++ b/cpukit/posix/src/pbarrierinit.c @@ -14,7 +14,7 @@ * COPYRIGHT (c) 1989-2006. * On-Line Applications Research Corporation (OAR). * - * Copyright (c) 2017 embedded brains GmbH + * Copyright (c) 2017 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/pbarrierwait.c b/cpukit/posix/src/pbarrierwait.c index 31314d2277..eeb6c27195 100644 --- a/cpukit/posix/src/pbarrierwait.c +++ b/cpukit/posix/src/pbarrierwait.c @@ -12,7 +12,7 @@ * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * - * Copyright (c) 2017 embedded brains GmbH + * Copyright (c) 2017 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/psignal.c b/cpukit/posix/src/psignal.c index a829c60ee1..3bfd779630 100644 --- a/cpukit/posix/src/psignal.c +++ b/cpukit/posix/src/psignal.c @@ -50,7 +50,6 @@ #include <rtems/posix/psignalimpl.h> #include <rtems/posix/pthreadimpl.h> #include <rtems/config.h> -#include <rtems/seterr.h> #include <rtems/sysinit.h> /* diff --git a/cpukit/posix/src/psignalclearsignals.c b/cpukit/posix/src/psignalclearsignals.c index f31cbf0d27..0c8ae8e1a6 100644 --- a/cpukit/posix/src/psignalclearsignals.c +++ b/cpukit/posix/src/psignalclearsignals.c @@ -44,7 +44,6 @@ #include <rtems/score/isr.h> #include <rtems/score/thread.h> -#include <rtems/seterr.h> #include <rtems/posix/threadsup.h> #include <rtems/posix/psignalimpl.h> #include <rtems/posix/pthreadimpl.h> diff --git a/cpukit/posix/src/psignalconfig.c b/cpukit/posix/src/psignalconfig.c index 5422b8dec1..21412d8e03 100644 --- a/cpukit/posix/src/psignalconfig.c +++ b/cpukit/posix/src/psignalconfig.c @@ -1,7 +1,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright 2018, 2019 embedded brains GmbH <rtems@embedded-brains.de> + * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/psignalsetprocesssignals.c b/cpukit/posix/src/psignalsetprocesssignals.c index 213de57406..9af03943f4 100644 --- a/cpukit/posix/src/psignalsetprocesssignals.c +++ b/cpukit/posix/src/psignalsetprocesssignals.c @@ -43,7 +43,6 @@ #include <rtems/score/isr.h> #include <rtems/score/thread.h> -#include <rtems/seterr.h> #include <rtems/posix/threadsup.h> #include <rtems/posix/psignalimpl.h> #include <rtems/posix/pthreadimpl.h> diff --git a/cpukit/posix/src/psignalunblockthread.c b/cpukit/posix/src/psignalunblockthread.c index 5b0168c22d..61c2602b96 100644 --- a/cpukit/posix/src/psignalunblockthread.c +++ b/cpukit/posix/src/psignalunblockthread.c @@ -46,7 +46,6 @@ #include <rtems/score/threadimpl.h> #include <rtems/score/threadqimpl.h> #include <rtems/score/watchdogimpl.h> -#include <rtems/seterr.h> #include <rtems/posix/threadsup.h> #include <rtems/posix/psignalimpl.h> #include <rtems/posix/pthreadimpl.h> diff --git a/cpukit/posix/src/pspindestroy.c b/cpukit/posix/src/pspindestroy.c index ece6d7a1bf..ef93333a1e 100644 --- a/cpukit/posix/src/pspindestroy.c +++ b/cpukit/posix/src/pspindestroy.c @@ -11,7 +11,7 @@ * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * - * Copyright (c) 2016 embedded brains GmbH + * Copyright (c) 2016 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/pspininit.c b/cpukit/posix/src/pspininit.c index dae429e8c8..980dc149d3 100644 --- a/cpukit/posix/src/pspininit.c +++ b/cpukit/posix/src/pspininit.c @@ -14,7 +14,7 @@ * COPYRIGHT (c) 1989-2006. * On-Line Applications Research Corporation (OAR). * - * Copyright (c) 2016 embedded brains GmbH + * Copyright (c) 2016 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/pspinlock.c b/cpukit/posix/src/pspinlock.c index aa374bc681..1267a41e97 100644 --- a/cpukit/posix/src/pspinlock.c +++ b/cpukit/posix/src/pspinlock.c @@ -11,7 +11,7 @@ * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * - * Copyright (c) 2016 embedded brains GmbH + * Copyright (c) 2016 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/pspinunlock.c b/cpukit/posix/src/pspinunlock.c index db095ad8e2..9cedaac361 100644 --- a/cpukit/posix/src/pspinunlock.c +++ b/cpukit/posix/src/pspinunlock.c @@ -14,7 +14,7 @@ * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * - * Copyright (c) 2016 embedded brains GmbH + * Copyright (c) 2016 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/psxsemaphore.c b/cpukit/posix/src/psxsemaphore.c index d87139ac1f..8136dfb7fc 100644 --- a/cpukit/posix/src/psxsemaphore.c +++ b/cpukit/posix/src/psxsemaphore.c @@ -9,7 +9,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (C) 2018 embedded brains GmbH + * Copyright (C) 2018 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/psxsemaphoreconfig.c b/cpukit/posix/src/psxsemaphoreconfig.c index f0a92a6c16..7f500f2f16 100644 --- a/cpukit/posix/src/psxsemaphoreconfig.c +++ b/cpukit/posix/src/psxsemaphoreconfig.c @@ -1,7 +1,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright 2018, embedded brains GmbH <rtems@embedded-brains.de> + * Copyright 2018, embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/psxtimerconfig.c b/cpukit/posix/src/psxtimerconfig.c index 4c1f107282..7673651622 100644 --- a/cpukit/posix/src/psxtimerconfig.c +++ b/cpukit/posix/src/psxtimerconfig.c @@ -1,7 +1,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright 2018, embedded brains GmbH <rtems@embedded-brains.de> + * Copyright 2018, embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/psxtimercreate.c b/cpukit/posix/src/psxtimercreate.c index 0eefac3f42..907da01836 100644 --- a/cpukit/posix/src/psxtimercreate.c +++ b/cpukit/posix/src/psxtimercreate.c @@ -51,6 +51,31 @@ #include <rtems/seterr.h> #include <rtems/sysinit.h> +RTEMS_WEAK int _POSIX_Timer_Is_allowed( + clockid_t clock_id +) +{ + int rc = 0; + + /* + * Allow timer_create(CLOCK_REALTIME. ...) per POSIX by default + * on CLOCK_REALTIME or CLOCK_MONOTONIC. + * + * But per the FACE Technical Standard, POSIX timers should not be + * allowed on CLOCK_REALTIME for safety reasons. If the application + * configures that it wants the FACE behavior, then this method + * is overridden by <rtems/confdefs/timer.h>. + */ + + if ( clock_id != CLOCK_REALTIME ) { + if ( clock_id != CLOCK_MONOTONIC ) { + rc = EINVAL; + } + } + + return rc; +} + int timer_create( clockid_t clock_id, struct sigevent *__restrict evp, @@ -58,9 +83,11 @@ int timer_create( ) { POSIX_Timer_Control *ptimer; + int rc; - if ( clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC ) - rtems_set_errno_and_return_minus_one( EINVAL ); + rc = _POSIX_Timer_Is_allowed( clock_id ); + if ( rc != 0 ) + rtems_set_errno_and_return_minus_one( rc ); if ( !timerid ) rtems_set_errno_and_return_minus_one( EINVAL ); diff --git a/cpukit/posix/src/pthreadatfork.c b/cpukit/posix/src/pthreadatfork.c index 1ee03a0111..27e6c725ea 100644 --- a/cpukit/posix/src/pthreadatfork.c +++ b/cpukit/posix/src/pthreadatfork.c @@ -8,7 +8,7 @@ */ /* - * COPYRIGHT (c) 1989-2007. + * COPYRIGHT (c) 1989-2007, 2022. * On-Line Applications Research Corporation (OAR). * * Redistribution and use in source and binary forms, with or without @@ -47,12 +47,8 @@ * * 3.1.3 Register Fork Handlers, P1003.1c/Draft 10, P1003.1c/Draft 10, p. 27 * - * RTEMS does not support processes, so we fall under this and do not - * provide this routine: - * - * "Either the implementation shall support the pthread_atfork() function - * as described above or the pthread_atfork() funciton shall not be - * provided." + * RTEMS does not support processes and we follow the FACE Technical Standard + * recommendation to return 0 when multiple processes are not supported. */ int pthread_atfork( void (*prepare)(void), @@ -63,5 +59,6 @@ int pthread_atfork( (void) prepare; (void) parent; (void) child; - rtems_set_errno_and_return_minus_one( ENOSYS ); + + return 0; } diff --git a/cpukit/posix/src/pthreadconfig.c b/cpukit/posix/src/pthreadconfig.c index 26525139db..ec1b6c13c7 100644 --- a/cpukit/posix/src/pthreadconfig.c +++ b/cpukit/posix/src/pthreadconfig.c @@ -1,7 +1,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright 2018, embedded brains GmbH <rtems@embedded-brains.de> + * Copyright 2018, embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/pthreaddetach.c b/cpukit/posix/src/pthreaddetach.c index f427a4bf2a..9b7d749cdf 100644 --- a/cpukit/posix/src/pthreaddetach.c +++ b/cpukit/posix/src/pthreaddetach.c @@ -12,7 +12,7 @@ * COPYRIGHT (c) 1989-2014. * On-Line Applications Research Corporation (OAR). * - * Copyright (c) 2016 embedded brains GmbH. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/pthreadexit.c b/cpukit/posix/src/pthreadexit.c index 79d3737067..29685156ea 100644 --- a/cpukit/posix/src/pthreadexit.c +++ b/cpukit/posix/src/pthreadexit.c @@ -12,7 +12,7 @@ * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * - * Copyright (c) 2016 embedded brains GmbH. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/pthreadgetnamenp.c b/cpukit/posix/src/pthreadgetnamenp.c index 882aa76925..d3b96c7ff7 100644 --- a/cpukit/posix/src/pthreadgetnamenp.c +++ b/cpukit/posix/src/pthreadgetnamenp.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-2-Clause */ /* - * Copyright (c) 2017 embedded brains GmbH. + * Copyright (c) 2017 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/pthreadgetschedparam.c b/cpukit/posix/src/pthreadgetschedparam.c index 09c2611ce9..88ea525d1b 100644 --- a/cpukit/posix/src/pthreadgetschedparam.c +++ b/cpukit/posix/src/pthreadgetschedparam.c @@ -47,7 +47,6 @@ #include <rtems/posix/pthreadimpl.h> #include <rtems/posix/pthreadattrimpl.h> #include <rtems/posix/priorityimpl.h> -#include <rtems/score/schedulerimpl.h> #include <rtems/score/threadimpl.h> int pthread_getschedparam( diff --git a/cpukit/posix/src/pthreadjoin.c b/cpukit/posix/src/pthreadjoin.c index 84ff15ceec..23a7749a81 100644 --- a/cpukit/posix/src/pthreadjoin.c +++ b/cpukit/posix/src/pthreadjoin.c @@ -14,7 +14,7 @@ * COPYRIGHT (c) 1989-2014. * On-Line Applications Research Corporation (OAR). * - * Copyright (c) 2016 embedded brains GmbH. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -54,26 +54,16 @@ static int _POSIX_Threads_Join( pthread_t thread, void **value_ptr ) { Thread_Control *the_thread; Thread_queue_Context queue_context; - Per_CPU_Control *cpu_self; Thread_Control *executing; - void *value; + Status_Control status; _Thread_queue_Context_initialize( &queue_context ); - _Thread_queue_Context_set_enqueue_do_nothing_extra( &queue_context ); the_thread = _Thread_Get( thread, &queue_context.Lock_context.Lock_context ); if ( the_thread == NULL ) { return ESRCH; } - cpu_self = _Per_CPU_Get(); - executing = _Per_CPU_Get_executing( cpu_self ); - - if ( executing == the_thread ) { - _ISR_lock_ISR_enable( &queue_context.Lock_context.Lock_context ); - return EDEADLK; - } - _Thread_State_acquire_critical( the_thread, &queue_context.Lock_context.Lock_context @@ -84,33 +74,20 @@ static int _POSIX_Threads_Join( pthread_t thread, void **value_ptr ) return EINVAL; } - if ( _States_Is_waiting_for_join_at_exit( the_thread->current_state ) ) { - value = the_thread->Life.exit_value; - _Thread_Clear_state_locked( the_thread, STATES_WAITING_FOR_JOIN_AT_EXIT ); - _Thread_Dispatch_disable_with_CPU( - cpu_self, - &queue_context.Lock_context.Lock_context - ); - _Thread_State_release( the_thread, &queue_context.Lock_context.Lock_context ); - _Thread_Dispatch_direct( cpu_self ); - } else { - _Thread_Join( - the_thread, - STATES_INTERRUPTIBLE_BY_SIGNAL | STATES_WAITING_FOR_JOIN, - executing, - &queue_context - ); - - if ( _POSIX_Get_error_after_wait( executing ) != 0 ) { - _Assert( _POSIX_Get_error_after_wait( executing ) == EINTR ); - return EINTR; - } - - value = executing->Wait.return_argument; + executing = _Thread_Executing; + status = _Thread_Join( + the_thread, + STATES_INTERRUPTIBLE_BY_SIGNAL | STATES_WAITING_FOR_JOIN, + executing, + &queue_context + ); + + if ( status != STATUS_SUCCESSFUL ) { + return _POSIX_Get_error( status ); } if ( value_ptr != NULL ) { - *value_ptr = value; + *value_ptr = executing->Wait.return_argument; } return 0; diff --git a/cpukit/posix/src/pthreadsetnamenp.c b/cpukit/posix/src/pthreadsetnamenp.c index 508384d761..a1aa5d8475 100644 --- a/cpukit/posix/src/pthreadsetnamenp.c +++ b/cpukit/posix/src/pthreadsetnamenp.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-2-Clause */ /* - * Copyright (c) 2017 embedded brains GmbH. + * Copyright (c) 2017 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/pthreadsetschedparam.c b/cpukit/posix/src/pthreadsetschedparam.c index 18168a5501..06508ef451 100644 --- a/cpukit/posix/src/pthreadsetschedparam.c +++ b/cpukit/posix/src/pthreadsetschedparam.c @@ -49,7 +49,6 @@ #include <rtems/posix/pthreadimpl.h> #include <rtems/posix/priorityimpl.h> #include <rtems/score/threadimpl.h> -#include <rtems/score/schedulerimpl.h> static int _POSIX_Set_sched_param( Thread_Control *the_thread, diff --git a/cpukit/posix/src/pthreadsetschedprio.c b/cpukit/posix/src/pthreadsetschedprio.c index fc887b9018..b6f2c068e1 100644 --- a/cpukit/posix/src/pthreadsetschedprio.c +++ b/cpukit/posix/src/pthreadsetschedprio.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-2-Clause */ /* - * Copyright (c) 2016 embedded brains GmbH + * Copyright (c) 2016 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/ptimer.c b/cpukit/posix/src/ptimer.c index 7ac0403220..5a8be40435 100644 --- a/cpukit/posix/src/ptimer.c +++ b/cpukit/posix/src/ptimer.c @@ -9,7 +9,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (C) 2018 embedded brains GmbH + * Copyright (C) 2018 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/setcancelstate.c b/cpukit/posix/src/setcancelstate.c index 64cc02c91c..bb994549c2 100644 --- a/cpukit/posix/src/setcancelstate.c +++ b/cpukit/posix/src/setcancelstate.c @@ -12,7 +12,7 @@ * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * - * Copyright (c) 2016 embedded brains GmbH. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/setcanceltype.c b/cpukit/posix/src/setcanceltype.c index 3beaac4c6a..23676a8eed 100644 --- a/cpukit/posix/src/setcanceltype.c +++ b/cpukit/posix/src/setcanceltype.c @@ -12,7 +12,7 @@ * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * - * Copyright (c) 2016 embedded brains GmbH. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/shm.c b/cpukit/posix/src/shm.c index 8f7df05956..0ec838b38f 100644 --- a/cpukit/posix/src/shm.c +++ b/cpukit/posix/src/shm.c @@ -9,7 +9,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (C) 2018 embedded brains GmbH + * Copyright (C) 2018 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/shmconfig.c b/cpukit/posix/src/shmconfig.c index 2d9fc1911b..0c09b58af4 100644 --- a/cpukit/posix/src/shmconfig.c +++ b/cpukit/posix/src/shmconfig.c @@ -1,7 +1,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright 2018, embedded brains GmbH <rtems@embedded-brains.de> + * Copyright 2018, embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/shmops.c b/cpukit/posix/src/shmops.c index 904df841a3..6d4f1ba9fd 100644 --- a/cpukit/posix/src/shmops.c +++ b/cpukit/posix/src/shmops.c @@ -1,7 +1,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018, embedded brains GmbH <rtems@embedded-brains.de> + * Copyright (c) 2018, embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/cpukit/posix/src/testcancel.c b/cpukit/posix/src/testcancel.c index 8f56c10e71..067a0f906b 100644 --- a/cpukit/posix/src/testcancel.c +++ b/cpukit/posix/src/testcancel.c @@ -12,7 +12,7 @@ * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * - * Copyright (c) 2016 embedded brains GmbH. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions |