diff options
Diffstat (limited to 'cpukit/posix/inline')
-rw-r--r-- | cpukit/posix/inline/rtems/posix/barrier.inl | 89 | ||||
-rw-r--r-- | cpukit/posix/inline/rtems/posix/cond.inl | 70 | ||||
-rw-r--r-- | cpukit/posix/inline/rtems/posix/key.inl | 86 | ||||
-rw-r--r-- | cpukit/posix/inline/rtems/posix/mqueue.inl | 160 | ||||
-rw-r--r-- | cpukit/posix/inline/rtems/posix/mutex.inl | 63 | ||||
-rw-r--r-- | cpukit/posix/inline/rtems/posix/priority.inl | 37 | ||||
-rw-r--r-- | cpukit/posix/inline/rtems/posix/pthread.inl | 77 | ||||
-rw-r--r-- | cpukit/posix/inline/rtems/posix/rwlock.inl | 89 | ||||
-rw-r--r-- | cpukit/posix/inline/rtems/posix/semaphore.inl | 92 | ||||
-rw-r--r-- | cpukit/posix/inline/rtems/posix/spinlock.inl | 89 | ||||
-rw-r--r-- | cpukit/posix/inline/rtems/posix/timer.inl | 98 |
11 files changed, 950 insertions, 0 deletions
diff --git a/cpukit/posix/inline/rtems/posix/barrier.inl b/cpukit/posix/inline/rtems/posix/barrier.inl new file mode 100644 index 0000000000..2557f33cd8 --- /dev/null +++ b/cpukit/posix/inline/rtems/posix/barrier.inl @@ -0,0 +1,89 @@ +/** + * @file rtems/posix/barrier.inl + */ + +/* + * This file contains the static inlin implementation of the inlined + * routines from the POSIX Barrier Manager. + * + * COPYRIGHT (c) 1989-2006. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_POSIX_BARRIER_H +# error "Never use <rtems/posix/barrier.inl> directly; include <rtems/posix/barrier.h> instead." +#endif + +#ifndef _RTEMS_POSIX_BARRIER_INL +#define _RTEMS_POSIX_BARRIER_INL + +#include <pthread.h> + +/** + * @brief _POSIX_Barrier_Allocate + * + * This function allocates a barrier control block from + * the inactive chain of free barrier control blocks. + */ +RTEMS_INLINE_ROUTINE POSIX_Barrier_Control *_POSIX_Barrier_Allocate( void ) +{ + return (POSIX_Barrier_Control *) + _Objects_Allocate( &_POSIX_Barrier_Information ); +} + +/** + * @brief _POSIX_Barrier_Free + * + * This routine frees a barrier control block to the + * inactive chain of free barrier control blocks. + */ +RTEMS_INLINE_ROUTINE void _POSIX_Barrier_Free ( + POSIX_Barrier_Control *the_barrier +) +{ + _Objects_Free( &_POSIX_Barrier_Information, &the_barrier->Object ); +} + +/** + * @brief _POSIX_Barrier_Get + * + * This function maps barrier IDs to barrier control blocks. + * If ID corresponds to a local barrier, then it returns + * the_barrier control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. if the barrier ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the_barrier is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the_barrier is undefined. + */ +RTEMS_INLINE_ROUTINE POSIX_Barrier_Control *_POSIX_Barrier_Get ( + pthread_barrier_t *barrier, + Objects_Locations *location +) +{ + return (POSIX_Barrier_Control *) _Objects_Get( + &_POSIX_Barrier_Information, + (Objects_Id) *barrier, + location + ); +} + +/** + * @brief _POSIX_Barrier_Is_null + * + * This function returns TRUE if the_barrier is NULL and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _POSIX_Barrier_Is_null ( + POSIX_Barrier_Control *the_barrier +) +{ + return ( the_barrier == NULL ); +} + +#endif +/* end of include file */ diff --git a/cpukit/posix/inline/rtems/posix/cond.inl b/cpukit/posix/inline/rtems/posix/cond.inl new file mode 100644 index 0000000000..3b011c0383 --- /dev/null +++ b/cpukit/posix/inline/rtems/posix/cond.inl @@ -0,0 +1,70 @@ +/** + * @file rtems/posix/cond.inl + */ + +/* rtems/posix/cond.inl + * + * This include file contains the static inline implementation of the private + * inlined routines for POSIX condition variables. + * + * COPYRIGHT (c) 1989-2002. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_POSIX_COND_H +# error "Never use <rtems/posix/cond.inl> directly; include <rtems/posix/cond.h> instead." +#endif + +#ifndef _RTEMS_POSIX_COND_INL +#define _RTEMS_POSIX_COND_INL + +#include <pthread.h> + +/*PAGE + * + * _POSIX_Condition_variables_Allocate + */ + +RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control + *_POSIX_Condition_variables_Allocate( void ) +{ + return (POSIX_Condition_variables_Control *) + _Objects_Allocate( &_POSIX_Condition_variables_Information ); +} + +/*PAGE + * + * _POSIX_Condition_variables_Free + */ + +RTEMS_INLINE_ROUTINE void _POSIX_Condition_variables_Free ( + POSIX_Condition_variables_Control *the_condition_variable +) +{ + _Objects_Free( + &_POSIX_Condition_variables_Information, + &the_condition_variable->Object + ); +} + +/*PAGE + * + * _POSIX_Condition_variables_Is_null + */ + +RTEMS_INLINE_ROUTINE bool _POSIX_Condition_variables_Is_null ( + POSIX_Condition_variables_Control *the_condition_variable +) +{ + return !the_condition_variable; +} + +#endif +/* end of include file */ + diff --git a/cpukit/posix/inline/rtems/posix/key.inl b/cpukit/posix/inline/rtems/posix/key.inl new file mode 100644 index 0000000000..c5c6324d06 --- /dev/null +++ b/cpukit/posix/inline/rtems/posix/key.inl @@ -0,0 +1,86 @@ +/** + * @file rtems/posix/key.inl + * + * This include file contains the static inline implementation of the private + * inlined routines for POSIX key's. + */ + +/* + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_POSIX_KEY_H +# error "Never use <rtems/posix/key.inl> directly; include <rtems/posix/key.h> instead." +#endif + +#ifndef _RTEMS_POSIX_KEY_INL +#define _RTEMS_POSIX_KEY_INL + +/** + * @brief _POSIX_Keys_Allocate + * + * This function allocates a keys control block from + * the inactive chain of free keys control blocks. + */ + +RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Allocate( void ) +{ + return (POSIX_Keys_Control *) _Objects_Allocate( &_POSIX_Keys_Information ); +} + +/** + * @brief _POSIX_Keys_Free + * + * This routine frees a keys control block to the + * inactive chain of free keys control blocks. + */ +RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free ( + POSIX_Keys_Control *the_key +) +{ + _Objects_Free( &_POSIX_Keys_Information, &the_key->Object ); +} + +/** + * @brief _POSIX_Keys_Get + * + * This function maps key IDs to key control blocks. + * If ID corresponds to a local keys, then it returns + * the_key control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. if the keys ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the_key is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the_key is undefined. + */ + +RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Get ( + pthread_key_t id, + Objects_Locations *location +) +{ + return (POSIX_Keys_Control *) + _Objects_Get( &_POSIX_Keys_Information, (Objects_Id) id, location ); +} + +/** + * @brief _POSIX_Keys_Is_null + * + * This function returns TRUE if the_key is NULL and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _POSIX_Keys_Is_null ( + POSIX_Keys_Control *the_key +) +{ + return !the_key; +} + +#endif +/* end of include file */ + diff --git a/cpukit/posix/inline/rtems/posix/mqueue.inl b/cpukit/posix/inline/rtems/posix/mqueue.inl new file mode 100644 index 0000000000..62bc3ce327 --- /dev/null +++ b/cpukit/posix/inline/rtems/posix/mqueue.inl @@ -0,0 +1,160 @@ +/** + * @file rtems/posix/mqueue.inl + */ + +/* rtems/posix/mqueue.inl + * + * This include file contains the static inline implementation of the private + * inlined routines for POSIX Message Queue. + * + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_POSIX_MQUEUE_H +# error "Never use <rtems/posix/mqueue.inl> directly; include <rtems/posix/mqueue.h> instead." +#endif + +#ifndef _RTEMS_POSIX_MQUEUE_INL +#define _RTEMS_POSIX_MQUEUE_INL + +/*PAGE + * + * _POSIX_Message_queue_Allocate + */ + +RTEMS_INLINE_ROUTINE + POSIX_Message_queue_Control *_POSIX_Message_queue_Allocate( void ) +{ + return (POSIX_Message_queue_Control *) + _Objects_Allocate( &_POSIX_Message_queue_Information ); +} + +/*PAGE + * + * _POSIX_Message_queue_Allocate_fd + */ + +RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control_fd * + _POSIX_Message_queue_Allocate_fd( void ) +{ + return (POSIX_Message_queue_Control_fd *) + _Objects_Allocate( &_POSIX_Message_queue_Information_fds ); +} + +/*PAGE + * + * _POSIX_Message_queue_Free + */ + +RTEMS_INLINE_ROUTINE void _POSIX_Message_queue_Free ( + POSIX_Message_queue_Control *the_mq +) +{ + _Objects_Free( &_POSIX_Message_queue_Information, &the_mq->Object ); +} + +/*PAGE + * + * _POSIX_Message_queue_Free_fd + */ + +RTEMS_INLINE_ROUTINE void _POSIX_Message_queue_Free_fd ( + POSIX_Message_queue_Control_fd *the_mq_fd +) +{ + _Objects_Free( &_POSIX_Message_queue_Information_fds, &the_mq_fd->Object ); +} + +/*PAGE + * + * _POSIX_Message_queue_Namespace_remove + */ + +RTEMS_INLINE_ROUTINE void _POSIX_Message_queue_Namespace_remove ( + POSIX_Message_queue_Control *the_mq +) +{ + _Objects_Namespace_remove( + &_POSIX_Message_queue_Information, &the_mq->Object ); +} + +/*PAGE + * + * _POSIX_Message_queue_Get + */ + +RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get ( + Objects_Id id, + Objects_Locations *location +) +{ + return (POSIX_Message_queue_Control *) + _Objects_Get( &_POSIX_Message_queue_Information, id, location ); +} + +/*PAGE + * + * _POSIX_Message_queue_Get_fd + */ + +RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control_fd *_POSIX_Message_queue_Get_fd ( + mqd_t id, + Objects_Locations *location +) +{ + return (POSIX_Message_queue_Control_fd *) _Objects_Get( + &_POSIX_Message_queue_Information_fds, + (Objects_Id)id, + location + ); +} + +/*PAGE + * + * _POSIX_Message_queue_Is_null + */ + +RTEMS_INLINE_ROUTINE bool _POSIX_Message_queue_Is_null ( + POSIX_Message_queue_Control *the_mq +) +{ + return !the_mq; +} + +/*PAGE + * + * _POSIX_Message_queue_Priority_to_core + */ + +RTEMS_INLINE_ROUTINE CORE_message_queue_Submit_types _POSIX_Message_queue_Priority_to_core( + unsigned int priority +) +{ + return priority * -1; +} + +/* + * _POSIX_Message_queue_Priority_from_core + * + * DESCRIPTION: + * + * XXX + */ + +RTEMS_INLINE_ROUTINE unsigned int _POSIX_Message_queue_Priority_from_core( + CORE_message_queue_Submit_types priority +) +{ + /* absolute value without a library dependency */ + return ((priority >= 0) ? priority : -priority); +} + +#endif +/* end of include file */ diff --git a/cpukit/posix/inline/rtems/posix/mutex.inl b/cpukit/posix/inline/rtems/posix/mutex.inl new file mode 100644 index 0000000000..b5e3721a3a --- /dev/null +++ b/cpukit/posix/inline/rtems/posix/mutex.inl @@ -0,0 +1,63 @@ +/** + * @file rtems/posix/mutex.inl + */ + +/* rtems/posix/mutex.inl + * + * This include file contains the static inline implementation of the private + * inlined routines for POSIX mutex's. + * + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_POSIX_MUTEX_H +# error "Never use <rtems/posix/mutex.inl> directly; include <rtems/posix/mutex.h> instead." +#endif + +#ifndef _RTEMS_POSIX_MUTEX_INL +#define _RTEMS_POSIX_MUTEX_INL + +/*PAGE + * + * _POSIX_Mutex_Allocate + */ + +RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void ) +{ + return (POSIX_Mutex_Control *) _Objects_Allocate( &_POSIX_Mutex_Information ); +} + +/*PAGE + * + * _POSIX_Mutex_Free + */ + +RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free ( + POSIX_Mutex_Control *the_mutex +) +{ + _Objects_Free( &_POSIX_Mutex_Information, &the_mutex->Object ); +} + +/*PAGE + * + * _POSIX_Mutex_Is_null + */ + +RTEMS_INLINE_ROUTINE bool _POSIX_Mutex_Is_null ( + POSIX_Mutex_Control *the_mutex +) +{ + return !the_mutex; +} + +#endif +/* end of include file */ + diff --git a/cpukit/posix/inline/rtems/posix/priority.inl b/cpukit/posix/inline/rtems/posix/priority.inl new file mode 100644 index 0000000000..9a9f538a61 --- /dev/null +++ b/cpukit/posix/inline/rtems/posix/priority.inl @@ -0,0 +1,37 @@ +/** + * @file rtems/posix/priority.inl + */ + +/* + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_POSIX_PRIORITY_H +# error "Never use <rtems/posix/priority.inl> directly; include <rtems/posix/priority.h> instead." +#endif + +#ifndef _RTEMS_POSIX_PRIORITY_INL +#define _RTEMS_POSIX_PRIORITY_INL + +RTEMS_INLINE_ROUTINE Priority_Control _POSIX_Priority_To_core( + int priority +) +{ + return (Priority_Control) (POSIX_SCHEDULER_MAXIMUM_PRIORITY - priority + 1); +} + +RTEMS_INLINE_ROUTINE int _POSIX_Priority_From_core( + Priority_Control priority +) +{ + return (POSIX_SCHEDULER_MAXIMUM_PRIORITY - priority + 1); +} + +#endif diff --git a/cpukit/posix/inline/rtems/posix/pthread.inl b/cpukit/posix/inline/rtems/posix/pthread.inl new file mode 100644 index 0000000000..7f35e9a08b --- /dev/null +++ b/cpukit/posix/inline/rtems/posix/pthread.inl @@ -0,0 +1,77 @@ +/** + * @file rtems/posix/pthread.inl + */ + +/* rtems/posix/pthread.inl + * + * This include file contains the static inline implementation of the private + * inlined routines for POSIX threads. + * + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_POSIX_PTHREAD_H +# error "Never use <rtems/posix/pthread.inl> directly; include <rtems/posix/pthread.h> instead." +#endif + +#ifndef _RTEMS_POSIX_PTHREAD_INL +#define _RTEMS_POSIX_PTHREAD_INL + +/*PAGE + * + * _POSIX_Threads_Allocate + */ + +RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate( void ) +{ + return (Thread_Control *) _Objects_Allocate( &_POSIX_Threads_Information ); +} + +/*PAGE + * + * _POSIX_Threads_Free + */ + +RTEMS_INLINE_ROUTINE void _POSIX_Threads_Free ( + Thread_Control *the_pthread +) +{ + _Objects_Free( &_POSIX_Threads_Information, &the_pthread->Object ); +} + +/*PAGE + * + * _POSIX_Threads_Get + */ + +RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Get ( + pthread_t id, + Objects_Locations *location +) +{ + return (Thread_Control *) + _Objects_Get( &_POSIX_Threads_Information, (Objects_Id)id, location ); +} + +/*PAGE + * + * _POSIX_Threads_Is_null + */ + +RTEMS_INLINE_ROUTINE bool _POSIX_Threads_Is_null ( + Thread_Control *the_pthread +) +{ + return !the_pthread; +} + +#endif +/* end of include file */ + diff --git a/cpukit/posix/inline/rtems/posix/rwlock.inl b/cpukit/posix/inline/rtems/posix/rwlock.inl new file mode 100644 index 0000000000..ac11d35d3c --- /dev/null +++ b/cpukit/posix/inline/rtems/posix/rwlock.inl @@ -0,0 +1,89 @@ +/** + * @file rtems/posix/RWLock.inl + */ + +/* + * This file contains the static inlin implementation of the inlined + * routines from the POSIX RWLock Manager. + * + * COPYRIGHT (c) 1989-2006. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_POSIX_RWLOCK_H +# error "Never use <rtems/posix/rwlock.inl> directly; include <rtems/posix/rwlock.h> instead." +#endif + +#ifndef _RTEMS_POSIX_RWLOCK_INL +#define _RTEMS_POSIX_RWLOCK_INL + +#include <pthread.h> + +/** + * @brief _POSIX_RWLock_Allocate + * + * This function allocates a RWLock control block from + * the inactive chain of free RWLock control blocks. + */ +RTEMS_INLINE_ROUTINE POSIX_RWLock_Control *_POSIX_RWLock_Allocate( void ) +{ + return (POSIX_RWLock_Control *) + _Objects_Allocate( &_POSIX_RWLock_Information ); +} + +/** + * @brief _POSIX_RWLock_Free + * + * This routine frees a RWLock control block to the + * inactive chain of free RWLock control blocks. + */ +RTEMS_INLINE_ROUTINE void _POSIX_RWLock_Free ( + POSIX_RWLock_Control *the_RWLock +) +{ + _Objects_Free( &_POSIX_RWLock_Information, &the_RWLock->Object ); +} + +/** + * @brief _POSIX_RWLock_Get + * + * This function maps RWLock IDs to RWLock control blocks. + * If ID corresponds to a local RWLock, then it returns + * the_RWLock control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. if the RWLock ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the_RWLock is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the_RWLock is undefined. + */ +RTEMS_INLINE_ROUTINE POSIX_RWLock_Control *_POSIX_RWLock_Get ( + pthread_rwlock_t *RWLock, + Objects_Locations *location +) +{ + return (POSIX_RWLock_Control *) _Objects_Get( + &_POSIX_RWLock_Information, + (Objects_Id) *RWLock, + location + ); +} + +/** + * @brief _POSIX_RWLock_Is_null + * + * This function returns TRUE if the_RWLock is NULL and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _POSIX_RWLock_Is_null ( + POSIX_RWLock_Control *the_RWLock +) +{ + return ( the_RWLock == NULL ); +} + +#endif +/* end of include file */ diff --git a/cpukit/posix/inline/rtems/posix/semaphore.inl b/cpukit/posix/inline/rtems/posix/semaphore.inl new file mode 100644 index 0000000000..eb885f1aa0 --- /dev/null +++ b/cpukit/posix/inline/rtems/posix/semaphore.inl @@ -0,0 +1,92 @@ +/** + * @file rtems/posix/semaphore.inl + */ + +/* rtems/posix/semaphore.inl + * + * This include file contains the static inline implementation of the private + * inlined routines for POSIX Semaphores. + * + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_POSIX_SEMAPHORE_H +# error "Never use <rtems/posix/semaphore.inl> directly; include <rtems/posix/semaphore.h> instead." +#endif + +#ifndef _RTEMS_POSIX_SEMAPHORE_INL +#define _RTEMS_POSIX_SEMAPHORE_INL + +/*PAGE + * + * _POSIX_Semaphore_Allocate + */ + +RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Allocate( void ) +{ + return (POSIX_Semaphore_Control *) + _Objects_Allocate( &_POSIX_Semaphore_Information ); +} + +/*PAGE + * + * _POSIX_Semaphore_Free + */ + +RTEMS_INLINE_ROUTINE void _POSIX_Semaphore_Free ( + POSIX_Semaphore_Control *the_semaphore +) +{ + _Objects_Free( &_POSIX_Semaphore_Information, &the_semaphore->Object ); +} + +/*PAGE + * + * _POSIX_Semaphore_Namespace_remove + */ + +RTEMS_INLINE_ROUTINE void _POSIX_Semaphore_Namespace_remove ( + POSIX_Semaphore_Control *the_semaphore +) +{ + _Objects_Namespace_remove( + &_POSIX_Semaphore_Information, &the_semaphore->Object ); +} + + + +/*PAGE + * + * _POSIX_Semaphore_Get + */ +RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get ( + sem_t *id, + Objects_Locations *location +) +{ + return (POSIX_Semaphore_Control *) + _Objects_Get( &_POSIX_Semaphore_Information, (Objects_Id)*id, location ); +} + +/*PAGE + * + * _POSIX_Semaphore_Is_null + */ + +RTEMS_INLINE_ROUTINE bool _POSIX_Semaphore_Is_null ( + POSIX_Semaphore_Control *the_semaphore +) +{ + return !the_semaphore; +} + +#endif +/* end of include file */ + diff --git a/cpukit/posix/inline/rtems/posix/spinlock.inl b/cpukit/posix/inline/rtems/posix/spinlock.inl new file mode 100644 index 0000000000..6007258e01 --- /dev/null +++ b/cpukit/posix/inline/rtems/posix/spinlock.inl @@ -0,0 +1,89 @@ +/** + * @file rtems/posix/spinlock.inl + */ + +/* + * This file contains the static inlin implementation of the inlined + * routines from the POSIX Spinlock Manager. + * + * COPYRIGHT (c) 1989-2006. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_POSIX_SPINLOCK_H +# error "Never use <rtems/posix/spinlock.inl> directly; include <rtems/posix/spinlock.h> instead." +#endif + +#ifndef _RTEMS_POSIX_SPINLOCK_INL +#define _RTEMS_POSIX_SPINLOCK_INL + +#include <pthread.h> + +/** + * @brief _POSIX_Spinlock_Allocate + * + * This function allocates a spinlock control block from + * the inactive chain of free spinlock control blocks. + */ +RTEMS_INLINE_ROUTINE POSIX_Spinlock_Control *_POSIX_Spinlock_Allocate( void ) +{ + return (POSIX_Spinlock_Control *) + _Objects_Allocate( &_POSIX_Spinlock_Information ); +} + +/** + * @brief _POSIX_Spinlock_Free + * + * This routine frees a spinlock control block to the + * inactive chain of free spinlock control blocks. + */ +RTEMS_INLINE_ROUTINE void _POSIX_Spinlock_Free ( + POSIX_Spinlock_Control *the_spinlock +) +{ + _Objects_Free( &_POSIX_Spinlock_Information, &the_spinlock->Object ); +} + +/** + * @brief _POSIX_Spinlock_Get + * + * This function maps spinlock IDs to spinlock control blocks. + * If ID corresponds to a local spinlock, then it returns + * the_spinlock control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. if the spinlock ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the_spinlock is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the_spinlock is undefined. + */ +RTEMS_INLINE_ROUTINE POSIX_Spinlock_Control *_POSIX_Spinlock_Get ( + pthread_spinlock_t *spinlock, + Objects_Locations *location +) +{ + return (POSIX_Spinlock_Control *) _Objects_Get( + &_POSIX_Spinlock_Information, + (Objects_Id) *spinlock, + location + ); +} + +/** + * @brief _POSIX_Spinlock_Is_null + * + * This function returns TRUE if the_spinlock is NULL and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _POSIX_Spinlock_Is_null ( + POSIX_Spinlock_Control *the_spinlock +) +{ + return ( the_spinlock == NULL ); +} + +#endif +/* end of include file */ diff --git a/cpukit/posix/inline/rtems/posix/timer.inl b/cpukit/posix/inline/rtems/posix/timer.inl new file mode 100644 index 0000000000..63db10c8ab --- /dev/null +++ b/cpukit/posix/inline/rtems/posix/timer.inl @@ -0,0 +1,98 @@ +/** + * @file rtems/posix/timer.inl + */ + +/* timer.inl + * + * This file contains the static inline implementation of the inlined routines + * from the POSIX Timer Manager. + * + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_POSIX_TIMER_H +# error "Never use <rtems/posix/timer.inl> directly; include <rtems/posix/timer.h> instead." +#endif + +#ifndef _RTEMS_POSIX_TIMER_INL +#define _RTEMS_POSIX_TIMER_INL + +/*PAGE + * + * _POSIX_Timer_Allocate + * + * DESCRIPTION: + * + * This function allocates a timer control block from + * the inactive chain of free timer control blocks. + */ + +RTEMS_INLINE_ROUTINE POSIX_Timer_Control *_POSIX_Timer_Allocate( void ) +{ + return (POSIX_Timer_Control *) _Objects_Allocate( &_POSIX_Timer_Information ); +} + +/*PAGE + * + * _POSIX_Timer_Free + * + * DESCRIPTION: + * + * This routine frees a timer control block to the + * inactive chain of free timer control blocks. + */ + +RTEMS_INLINE_ROUTINE void _POSIX_Timer_Free ( + POSIX_Timer_Control *the_timer +) +{ + _Objects_Free( &_POSIX_Timer_Information, &the_timer->Object ); +} + +/*PAGE + * + * _POSIX_Timer_Get + * + * DESCRIPTION: + * + * This function maps timer IDs to timer control blocks. + * If ID corresponds to a local timer, then it returns + * the timer control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. Otherwise, location is set + * to OBJECTS_ERROR and the returned value is undefined. + */ + +RTEMS_INLINE_ROUTINE POSIX_Timer_Control *_POSIX_Timer_Get ( + timer_t id, + Objects_Locations *location +) +{ + return (POSIX_Timer_Control *) + _Objects_Get( &_POSIX_Timer_Information, (Objects_Id) id, location ); +} + +/*PAGE + * + * _POSIX_Timer_Is_null + * + * DESCRIPTION: + * + * This function returns TRUE if the_timer is NULL and FALSE otherwise. + */ + +RTEMS_INLINE_ROUTINE bool _POSIX_Timer_Is_null ( + POSIX_Timer_Control *the_timer +) +{ + return (the_timer == NULL); +} + +#endif +/* end of include file */ |