2000-12-01 Joel Sherrill <joel@OARcorp.com>

* Added macro support to POSIX API.  This is known to compile.
	* macros/rtems/posix/cond.inl, macros/rtems/posix/intr.inl,
	macros/rtems/posix/key.inl, macros/rtems/posix/mqueue.inl,
	macros/rtems/posix/mutex.inl, macros/rtems/posix/priority.inl,
	macros/rtems/posix/pthread.inl, macros/rtems/posix/semaphore.inl,
	macros/rtems/posix/timer.inl: New files.
	* configure.in: Removed error check for enabling macros.
	* rtems/posix/mutex.h: #if 0'ed out prototypes for inlined routines
	since you cannot have prototypes for macros.
	* macros/rtems/posix/Makefile.am: Added files.
This commit is contained in:
Joel Sherrill
2000-12-01 18:57:36 +00:00
parent cde0ec8c5c
commit 2b2bda48c1
24 changed files with 1134 additions and 11 deletions

View File

@@ -1,3 +1,16 @@
2000-12-01 Joel Sherrill <joel@OARcorp.com>
* Added macro support to POSIX API. This is known to compile.
* macros/rtems/posix/cond.inl, macros/rtems/posix/intr.inl,
macros/rtems/posix/key.inl, macros/rtems/posix/mqueue.inl,
macros/rtems/posix/mutex.inl, macros/rtems/posix/priority.inl,
macros/rtems/posix/pthread.inl, macros/rtems/posix/semaphore.inl,
macros/rtems/posix/timer.inl: New files.
* configure.in: Removed error check for enabling macros.
* rtems/posix/mutex.h: #if 0'ed out prototypes for inlined routines
since you cannot have prototypes for macros.
* macros/rtems/posix/Makefile.am: Added files.
2000-11-30 Joel Sherrill <joel@OARcorp.com>
* inline/rtems/posix/mqueue.inl: Removed explicit dependency on abs().

View File

@@ -31,10 +31,6 @@ RTEMS_CHECK_POSIX_API(RTEMS_BSP)
# If RTEMS macros are enabled, then use them. Otherwise, use inlines.
if test "$RTEMS_USE_MACROS" = "yes"; then
INLINEdir="macros"
if test "$HAS_POSIX_API" = "yes"; then
# The problem is that there is currently no code in posix/macros :)
AC_MSG_ERROR(Macros are not implemented for the POSIX API)
fi
else
INLINEdir="inline"
fi
@@ -50,12 +46,6 @@ if test "$HAS_POSIX_API" != "yes"; then
AC_MSG_ERROR([BSP $RTEMS_BSP does not support libposix])
fi
# If RTEMS macros are enabled, then use them. Otherwise, refuse to build
if test "$RTEMS_USE_MACROS" = "yes"; then
# The problem is that there is currently no code in posix/macros :)
AC_MSG_ERROR(Macros are not implemented for the POSIX API)
fi
# Explicitly list all Makefiles here
AC_OUTPUT(
Makefile

View File

@@ -82,6 +82,7 @@ RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free (
POSIX_Mutex_Control *the_mutex
);
#if 0
/*
* _POSIX_Mutex_Get
*
@@ -112,6 +113,7 @@ RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Get (
RTEMS_INLINE_ROUTINE boolean _POSIX_Mutex_Is_null (
POSIX_Mutex_Control *the_mutex
);
#endif
/*
* _POSIX_Mutex_Lock_support

View File

@@ -5,7 +5,8 @@
AUTOMAKE_OPTIONS = foreign 1.4
if MACROS
I_FILES =
I_FILES = cond.inl intr.inl key.inl mqueue.inl mutex.inl priority.inl \
pthread.inl semaphore.inl timer.inl
noinst_HEADERS = $(I_FILES)

View File

@@ -0,0 +1,66 @@
/* rtems/posix/cond.inl
*
* This include file contains the macro implementation of the private
* inlined routines for POSIX condition variables.
*
* 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_inl
#define __RTEMS_POSIX_CONDITION_VARIABLES_inl
/*PAGE
*
* _POSIX_Condition_variables_Allocate
*/
#define _POSIX_Condition_variables_Allocate() \
(POSIX_Condition_variables_Control *) \
_Objects_Allocate( &_POSIX_Condition_variables_Information )
/*PAGE
*
* _POSIX_Condition_variables_Free
*/
#define _POSIX_Condition_variables_Free( _the_condition_variable ) \
_Objects_Free( &_POSIX_Condition_variables_Information, \
&(_the_condition_variable)->Object)
/*PAGE
*
* _POSIX_Condition_variables_Get
*/
/* XXX how to write this as a macro */
static POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
Objects_Id *id,
Objects_Locations *location
)
{
/* XXX should support COND_INITIALIZER */
if ( id )
return (POSIX_Condition_variables_Control *)
_Objects_Get( &_POSIX_Condition_variables_Information, *id, location );
*location = OBJECTS_ERROR;
return NULL;
}
/*PAGE
*
* _POSIX_Condition_variables_Is_null
*/
#define _POSIX_Condition_variables_Is_null( _the_condition_variable ) \
(!(_the_condition_variable))
#endif
/* end of include file */

View File

@@ -0,0 +1,55 @@
/* rtems/posix/intr.inl
*
* This include file contains the macro implementation of the private
* inlined routines for POSIX Interrupt 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#ifndef __RTEMS_POSIX_INTERRUPT_inl
#define __RTEMS_POSIX_INTERRUPT_inl
/*PAGE
*
* _POSIX_Interrupt_Allocate
*/
#define _POSIX_Interrupt_Allocate() \
(POSIX_Interrupt_Handler_control *) \
_Objects_Allocate( &_POSIX_Interrupt_Handlers_Information )
/*PAGE
*
* _POSIX_Interrupt_Free
*/
#define _POSIX_Interrupt_Free( _the_intr ) \
_Objects_Free( &_POSIX_Interrupt_Handlers_Information, &(_the_intr)->Object )
/*PAGE
*
* _POSIX_Interrupt_Get
*/
#define _POSIX_Interrupt_Get( _id, _location ) \
(POSIX_Interrupt_Control *) \
_Objects_Get( &_POSIX_Interrupt_Handlers_Information, (_id), (_location) )
/*PAGE
*
* _POSIX_Interrupt_Is_null
*/
#define _POSIX_Interrupt_Is_null( _the_intr ) \
(!(_the_intr))
#endif
/* end of include file */

View File

@@ -0,0 +1,54 @@
/* rtems/posix/key.inl
*
* This include file contains the macro 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#ifndef __RTEMS_POSIX_KEY_inl
#define __RTEMS_POSIX_KEY_inl
/*PAGE
*
* _POSIX_Keys_Allocate
*/
#define _POSIX_Keys_Allocate() \
(POSIX_Keys_Control *) _Objects_Allocate( &_POSIX_Keys_Information )
/*PAGE
*
* _POSIX_Keys_Free
*/
#define _POSIX_Keys_Free( _the_key ) \
_Objects_Free( &_POSIX_Keys_Information, &(_the_key)->Object );
/*PAGE
*
* _POSIX_Keys_Get
*/
#define _POSIX_Keys_Get( _id, _location ) \
(POSIX_Keys_Control *) \
_Objects_Get( &_POSIX_Keys_Information, (_id), (_location) )
/*PAGE
*
* _POSIX_Keys_Is_null
*/
#define _POSIX_Keys_Is_null( _the_key ) \
(!(_the_key))
#endif
/* end of include file */

View File

@@ -0,0 +1,80 @@
/* rtems/posix/mqueue.inl
*
* This include file contains the macro 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#ifndef __RTEMS_POSIX_MESSAGE_QUEUE_inl
#define __RTEMS_POSIX_MESSAGE_QUEUE_inl
/*PAGE
*
* _POSIX_Message_queue_Allocate
*/
#define _POSIX_Message_queue_Allocate() \
(POSIX_Message_queue_Control *) \
_Objects_Allocate( &_POSIX_Message_queue_Information )
/*PAGE
*
* _POSIX_Message_queue_Free
*/
#define _POSIX_Message_queue_Free( _the_mq ) \
_Objects_Free( &_POSIX_Message_queue_Information, &(_the_mq)->Object )
/*PAGE
*
* _POSIX_Message_queue_Namespace_remove
*/
#define _POSIX_Message_queue_Namespace_remove( _the_mq ) \
_Objects_Namespace_remove( \
&_POSIX_Message_queue_Information, &(_the_mq)->Object )
/*PAGE
*
* _POSIX_Message_queue_Get
*/
#define _POSIX_Message_queue_Get( _id, _location ) \
(POSIX_Message_queue_Control *) \
_Objects_Get( &_POSIX_Message_queue_Information, (_id), (_location) )
/*PAGE
*
* _POSIX_Message_queue_Is_null
*/
#define _POSIX_Message_queue_Is_null( _the_mq ) \
(!(_the_mq))
/*PAGE
*
* _POSIX_Message_queue_Priority_to_core
*/
#define _POSIX_Message_queue_Priority_to_core( _priority ) \
((_priority) * -1)
/*
* _POSIX_Message_queue_Priority_from_core
*/
/* absolute value without a library dependency */
#define _POSIX_Message_queue_Priority_from_core( _priority ) \
((((_priority) >= 0) ? (_priority) : -(_priority)))
#endif
/* end of include file */

View File

@@ -0,0 +1,100 @@
/* rtems/posix/mutex.inl
*
* This include file contains the macro 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#ifndef __RTEMS_POSIX_MUTEX_inl
#define __RTEMS_POSIX_MUTEX_inl
/*PAGE
*
* _POSIX_Mutex_Allocate
*/
#define _POSIX_Mutex_Allocate() \
(POSIX_Mutex_Control *) _Objects_Allocate( &_POSIX_Mutex_Information )
/*PAGE
*
* _POSIX_Mutex_Free
*/
#define _POSIX_Mutex_Free( _the_mutex ) \
_Objects_Free( &_POSIX_Mutex_Information, &(_the_mutex)->Object )
/*PAGE
*
* _POSIX_Mutex_Get
*
* NOTE: The support macro makes it possible for both to use exactly
* the same code to check for NULL id pointer and
* PTHREAD_MUTEX_INITIALIZER without adding overhead.
*/
#define ___POSIX_Mutex_Get_support( _id, _location ) \
do { \
int _status; \
\
if ( !_id ) { \
*_location = OBJECTS_ERROR; \
return (POSIX_Mutex_Control *) 0; \
} \
\
if ( *_id == PTHREAD_MUTEX_INITIALIZER ) { \
/* \
* Do an "auto-create" here. \
*/ \
\
_status = pthread_mutex_init( _id, 0 ); \
if ( _status ) { \
*_location = OBJECTS_ERROR; \
return (POSIX_Mutex_Control *) 0; \
} \
} \
} while (0)
static POSIX_Mutex_Control * _POSIX_Mutex_Get(
Objects_Id *id,
Objects_Locations *location
)
{
___POSIX_Mutex_Get_support( id, location );
return (POSIX_Mutex_Control *)
_Objects_Get( &_POSIX_Mutex_Information, *id, location );
}
static POSIX_Mutex_Control *_POSIX_Mutex_Get_interrupt_disable(
Objects_Id *id,
Objects_Locations *location,
ISR_Level *level
)
{
___POSIX_Mutex_Get_support( id, location );
return (POSIX_Mutex_Control *)
_Objects_Get_isr_disable( &_POSIX_Mutex_Information, *id, location, level );
}
/*PAGE
*
* _POSIX_Mutex_Is_null
*/
#define _POSIX_Mutex_Is_null( _the_mutex ) \
(!(_the_mutex))
#endif
/* end of include file */

View File

@@ -0,0 +1,25 @@
/*
* $Id$
*/
#ifndef __RTEMS_POSIX_PRIORITY_inl
#define __RTEMS_POSIX_PRIORITY_inl
/*
* 1003.1b-1993,2.2.2.80 definition of priority, p. 19
*
* "Numericallly higher values represent higher priorities."
*
* Thus, RTEMS Core has priorities run in the opposite sense of the POSIX API.
*/
#define _POSIX_Priority_Is_valid( _priority ) \
((boolean) ((_priority) >= 1 && (_priority) <= 254))
#define _POSIX_Priority_To_core( _priority ) \
((Priority_Control) (255 - (_priority)))
#define _POSIX_Priority_From_core( _priority ) \
(255 - (_priority))
#endif

View File

@@ -0,0 +1,54 @@
/* rtems/posix/pthread.inl
*
* This include file contains the macro 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#ifndef __RTEMS_POSIX_THREADS_inl
#define __RTEMS_POSIX_THREADS_inl
/*PAGE
*
* _POSIX_Threads_Allocate
*/
#define _POSIX_Threads_Allocate() \
(Thread_Control *) _Objects_Allocate( &_POSIX_Threads_Information )
/*PAGE
*
* _POSIX_Threads_Free
*/
#define _POSIX_Threads_Free( _the_pthread ) \
_Objects_Free( &_POSIX_Threads_Information, &(_the_pthread)->Object )
/*PAGE
*
* _POSIX_Threads_Get
*/
#define _POSIX_Threads_Get( _id, _location ) \
(Thread_Control *) \
_Objects_Get( &_POSIX_Threads_Information, (Objects_Id)(_id), (_location) )
/*PAGE
*
* _POSIX_Threads_Is_null
*/
#define _POSIX_Threads_Is_null( _the_pthread ) \
(!(_the_pthread))
#endif
/* end of include file */

View File

@@ -0,0 +1,64 @@
/* rtems/posix/semaphore.inl
*
* This include file contains the macro 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#ifndef __RTEMS_POSIX_SEMAPHORE_inl
#define __RTEMS_POSIX_SEMAPHORE_inl
/*PAGE
*
* _POSIX_Semaphore_Allocate
*/
#define _POSIX_Semaphore_Allocate() \
(POSIX_Semaphore_Control *) \
_Objects_Allocate( &_POSIX_Semaphore_Information );
/*PAGE
*
* _POSIX_Semaphore_Free
*/
#define _POSIX_Semaphore_Free( _the_semaphore ) \
_Objects_Free( &_POSIX_Semaphore_Information, &(_the_semaphore)->Object )
/*PAGE
*
* _POSIX_Semaphore_Namespace_remove
*/
#define _POSIX_Semaphore_Namespace_remove( _the_semaphore ) \
_Objects_Namespace_remove( \
&_POSIX_Semaphore_Information, &(_the_semaphore)->Object )
/*PAGE
*
* _POSIX_Semaphore_Get
*/
#define _POSIX_Semaphore_Get( _id, _location ) \
(POSIX_Semaphore_Control *) \
_Objects_Get( &_POSIX_Semaphore_Information, *(_id), (_location) )
/*PAGE
*
* _POSIX_Semaphore_Is_null
*/
#define _POSIX_Semaphore_Is_null( _the_semaphore ) \
(!(_the_semaphore))
#endif
/* end of include file */

View File

@@ -0,0 +1,53 @@
/* timer.inl
*
* This file contains the macro 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#ifndef __POSIX_TIMER_inl
#define __POSIX_TIMER_inl
/*PAGE
*
* _POSIX_Timer_Allocate
*/
#define _POSIX_Timer_Allocate() \
(POSIX_Timer_Control *) _Objects_Allocate( &_POSIX_Timer_Information )
/*PAGE
*
* _POSIX_Timer_Free
*/
#define _POSIX_Timer_Free( _the_timer ) \
_Objects_Free( &_POSIX_Timer_Information, &(_the_timer)->Object );
/*PAGE
*
* _POSIX_Timer_Get
*/
#define _POSIX_Timer_Get( _the_timer ) \
(POSIX_Timer_Control *) \
_Objects_Get( &_POSIX_Timer_Information, (_id), (_location) )
/*PAGE
*
* _POSIX_Timer_Is_null
*/
#define _POSIX_Timer_Is_null( _the_timer ) \
(!(_the_timer))
#endif
/* end of include file */

View File

@@ -1,3 +1,16 @@
2000-12-01 Joel Sherrill <joel@OARcorp.com>
* Added macro support to POSIX API. This is known to compile.
* macros/rtems/posix/cond.inl, macros/rtems/posix/intr.inl,
macros/rtems/posix/key.inl, macros/rtems/posix/mqueue.inl,
macros/rtems/posix/mutex.inl, macros/rtems/posix/priority.inl,
macros/rtems/posix/pthread.inl, macros/rtems/posix/semaphore.inl,
macros/rtems/posix/timer.inl: New files.
* configure.in: Removed error check for enabling macros.
* rtems/posix/mutex.h: #if 0'ed out prototypes for inlined routines
since you cannot have prototypes for macros.
* macros/rtems/posix/Makefile.am: Added files.
2000-11-30 Joel Sherrill <joel@OARcorp.com>
* inline/rtems/posix/mqueue.inl: Removed explicit dependency on abs().

View File

@@ -82,6 +82,7 @@ RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free (
POSIX_Mutex_Control *the_mutex
);
#if 0
/*
* _POSIX_Mutex_Get
*
@@ -112,6 +113,7 @@ RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Get (
RTEMS_INLINE_ROUTINE boolean _POSIX_Mutex_Is_null (
POSIX_Mutex_Control *the_mutex
);
#endif
/*
* _POSIX_Mutex_Lock_support

View File

@@ -0,0 +1,66 @@
/* rtems/posix/cond.inl
*
* This include file contains the macro implementation of the private
* inlined routines for POSIX condition variables.
*
* 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_inl
#define __RTEMS_POSIX_CONDITION_VARIABLES_inl
/*PAGE
*
* _POSIX_Condition_variables_Allocate
*/
#define _POSIX_Condition_variables_Allocate() \
(POSIX_Condition_variables_Control *) \
_Objects_Allocate( &_POSIX_Condition_variables_Information )
/*PAGE
*
* _POSIX_Condition_variables_Free
*/
#define _POSIX_Condition_variables_Free( _the_condition_variable ) \
_Objects_Free( &_POSIX_Condition_variables_Information, \
&(_the_condition_variable)->Object)
/*PAGE
*
* _POSIX_Condition_variables_Get
*/
/* XXX how to write this as a macro */
static POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
Objects_Id *id,
Objects_Locations *location
)
{
/* XXX should support COND_INITIALIZER */
if ( id )
return (POSIX_Condition_variables_Control *)
_Objects_Get( &_POSIX_Condition_variables_Information, *id, location );
*location = OBJECTS_ERROR;
return NULL;
}
/*PAGE
*
* _POSIX_Condition_variables_Is_null
*/
#define _POSIX_Condition_variables_Is_null( _the_condition_variable ) \
(!(_the_condition_variable))
#endif
/* end of include file */

View File

@@ -0,0 +1,55 @@
/* rtems/posix/intr.inl
*
* This include file contains the macro implementation of the private
* inlined routines for POSIX Interrupt 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#ifndef __RTEMS_POSIX_INTERRUPT_inl
#define __RTEMS_POSIX_INTERRUPT_inl
/*PAGE
*
* _POSIX_Interrupt_Allocate
*/
#define _POSIX_Interrupt_Allocate() \
(POSIX_Interrupt_Handler_control *) \
_Objects_Allocate( &_POSIX_Interrupt_Handlers_Information )
/*PAGE
*
* _POSIX_Interrupt_Free
*/
#define _POSIX_Interrupt_Free( _the_intr ) \
_Objects_Free( &_POSIX_Interrupt_Handlers_Information, &(_the_intr)->Object )
/*PAGE
*
* _POSIX_Interrupt_Get
*/
#define _POSIX_Interrupt_Get( _id, _location ) \
(POSIX_Interrupt_Control *) \
_Objects_Get( &_POSIX_Interrupt_Handlers_Information, (_id), (_location) )
/*PAGE
*
* _POSIX_Interrupt_Is_null
*/
#define _POSIX_Interrupt_Is_null( _the_intr ) \
(!(_the_intr))
#endif
/* end of include file */

View File

@@ -0,0 +1,54 @@
/* rtems/posix/key.inl
*
* This include file contains the macro 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#ifndef __RTEMS_POSIX_KEY_inl
#define __RTEMS_POSIX_KEY_inl
/*PAGE
*
* _POSIX_Keys_Allocate
*/
#define _POSIX_Keys_Allocate() \
(POSIX_Keys_Control *) _Objects_Allocate( &_POSIX_Keys_Information )
/*PAGE
*
* _POSIX_Keys_Free
*/
#define _POSIX_Keys_Free( _the_key ) \
_Objects_Free( &_POSIX_Keys_Information, &(_the_key)->Object );
/*PAGE
*
* _POSIX_Keys_Get
*/
#define _POSIX_Keys_Get( _id, _location ) \
(POSIX_Keys_Control *) \
_Objects_Get( &_POSIX_Keys_Information, (_id), (_location) )
/*PAGE
*
* _POSIX_Keys_Is_null
*/
#define _POSIX_Keys_Is_null( _the_key ) \
(!(_the_key))
#endif
/* end of include file */

View File

@@ -0,0 +1,80 @@
/* rtems/posix/mqueue.inl
*
* This include file contains the macro 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#ifndef __RTEMS_POSIX_MESSAGE_QUEUE_inl
#define __RTEMS_POSIX_MESSAGE_QUEUE_inl
/*PAGE
*
* _POSIX_Message_queue_Allocate
*/
#define _POSIX_Message_queue_Allocate() \
(POSIX_Message_queue_Control *) \
_Objects_Allocate( &_POSIX_Message_queue_Information )
/*PAGE
*
* _POSIX_Message_queue_Free
*/
#define _POSIX_Message_queue_Free( _the_mq ) \
_Objects_Free( &_POSIX_Message_queue_Information, &(_the_mq)->Object )
/*PAGE
*
* _POSIX_Message_queue_Namespace_remove
*/
#define _POSIX_Message_queue_Namespace_remove( _the_mq ) \
_Objects_Namespace_remove( \
&_POSIX_Message_queue_Information, &(_the_mq)->Object )
/*PAGE
*
* _POSIX_Message_queue_Get
*/
#define _POSIX_Message_queue_Get( _id, _location ) \
(POSIX_Message_queue_Control *) \
_Objects_Get( &_POSIX_Message_queue_Information, (_id), (_location) )
/*PAGE
*
* _POSIX_Message_queue_Is_null
*/
#define _POSIX_Message_queue_Is_null( _the_mq ) \
(!(_the_mq))
/*PAGE
*
* _POSIX_Message_queue_Priority_to_core
*/
#define _POSIX_Message_queue_Priority_to_core( _priority ) \
((_priority) * -1)
/*
* _POSIX_Message_queue_Priority_from_core
*/
/* absolute value without a library dependency */
#define _POSIX_Message_queue_Priority_from_core( _priority ) \
((((_priority) >= 0) ? (_priority) : -(_priority)))
#endif
/* end of include file */

View File

@@ -0,0 +1,100 @@
/* rtems/posix/mutex.inl
*
* This include file contains the macro 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#ifndef __RTEMS_POSIX_MUTEX_inl
#define __RTEMS_POSIX_MUTEX_inl
/*PAGE
*
* _POSIX_Mutex_Allocate
*/
#define _POSIX_Mutex_Allocate() \
(POSIX_Mutex_Control *) _Objects_Allocate( &_POSIX_Mutex_Information )
/*PAGE
*
* _POSIX_Mutex_Free
*/
#define _POSIX_Mutex_Free( _the_mutex ) \
_Objects_Free( &_POSIX_Mutex_Information, &(_the_mutex)->Object )
/*PAGE
*
* _POSIX_Mutex_Get
*
* NOTE: The support macro makes it possible for both to use exactly
* the same code to check for NULL id pointer and
* PTHREAD_MUTEX_INITIALIZER without adding overhead.
*/
#define ___POSIX_Mutex_Get_support( _id, _location ) \
do { \
int _status; \
\
if ( !_id ) { \
*_location = OBJECTS_ERROR; \
return (POSIX_Mutex_Control *) 0; \
} \
\
if ( *_id == PTHREAD_MUTEX_INITIALIZER ) { \
/* \
* Do an "auto-create" here. \
*/ \
\
_status = pthread_mutex_init( _id, 0 ); \
if ( _status ) { \
*_location = OBJECTS_ERROR; \
return (POSIX_Mutex_Control *) 0; \
} \
} \
} while (0)
static POSIX_Mutex_Control * _POSIX_Mutex_Get(
Objects_Id *id,
Objects_Locations *location
)
{
___POSIX_Mutex_Get_support( id, location );
return (POSIX_Mutex_Control *)
_Objects_Get( &_POSIX_Mutex_Information, *id, location );
}
static POSIX_Mutex_Control *_POSIX_Mutex_Get_interrupt_disable(
Objects_Id *id,
Objects_Locations *location,
ISR_Level *level
)
{
___POSIX_Mutex_Get_support( id, location );
return (POSIX_Mutex_Control *)
_Objects_Get_isr_disable( &_POSIX_Mutex_Information, *id, location, level );
}
/*PAGE
*
* _POSIX_Mutex_Is_null
*/
#define _POSIX_Mutex_Is_null( _the_mutex ) \
(!(_the_mutex))
#endif
/* end of include file */

View File

@@ -0,0 +1,25 @@
/*
* $Id$
*/
#ifndef __RTEMS_POSIX_PRIORITY_inl
#define __RTEMS_POSIX_PRIORITY_inl
/*
* 1003.1b-1993,2.2.2.80 definition of priority, p. 19
*
* "Numericallly higher values represent higher priorities."
*
* Thus, RTEMS Core has priorities run in the opposite sense of the POSIX API.
*/
#define _POSIX_Priority_Is_valid( _priority ) \
((boolean) ((_priority) >= 1 && (_priority) <= 254))
#define _POSIX_Priority_To_core( _priority ) \
((Priority_Control) (255 - (_priority)))
#define _POSIX_Priority_From_core( _priority ) \
(255 - (_priority))
#endif

View File

@@ -0,0 +1,54 @@
/* rtems/posix/pthread.inl
*
* This include file contains the macro 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#ifndef __RTEMS_POSIX_THREADS_inl
#define __RTEMS_POSIX_THREADS_inl
/*PAGE
*
* _POSIX_Threads_Allocate
*/
#define _POSIX_Threads_Allocate() \
(Thread_Control *) _Objects_Allocate( &_POSIX_Threads_Information )
/*PAGE
*
* _POSIX_Threads_Free
*/
#define _POSIX_Threads_Free( _the_pthread ) \
_Objects_Free( &_POSIX_Threads_Information, &(_the_pthread)->Object )
/*PAGE
*
* _POSIX_Threads_Get
*/
#define _POSIX_Threads_Get( _id, _location ) \
(Thread_Control *) \
_Objects_Get( &_POSIX_Threads_Information, (Objects_Id)(_id), (_location) )
/*PAGE
*
* _POSIX_Threads_Is_null
*/
#define _POSIX_Threads_Is_null( _the_pthread ) \
(!(_the_pthread))
#endif
/* end of include file */

View File

@@ -0,0 +1,64 @@
/* rtems/posix/semaphore.inl
*
* This include file contains the macro 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#ifndef __RTEMS_POSIX_SEMAPHORE_inl
#define __RTEMS_POSIX_SEMAPHORE_inl
/*PAGE
*
* _POSIX_Semaphore_Allocate
*/
#define _POSIX_Semaphore_Allocate() \
(POSIX_Semaphore_Control *) \
_Objects_Allocate( &_POSIX_Semaphore_Information );
/*PAGE
*
* _POSIX_Semaphore_Free
*/
#define _POSIX_Semaphore_Free( _the_semaphore ) \
_Objects_Free( &_POSIX_Semaphore_Information, &(_the_semaphore)->Object )
/*PAGE
*
* _POSIX_Semaphore_Namespace_remove
*/
#define _POSIX_Semaphore_Namespace_remove( _the_semaphore ) \
_Objects_Namespace_remove( \
&_POSIX_Semaphore_Information, &(_the_semaphore)->Object )
/*PAGE
*
* _POSIX_Semaphore_Get
*/
#define _POSIX_Semaphore_Get( _id, _location ) \
(POSIX_Semaphore_Control *) \
_Objects_Get( &_POSIX_Semaphore_Information, *(_id), (_location) )
/*PAGE
*
* _POSIX_Semaphore_Is_null
*/
#define _POSIX_Semaphore_Is_null( _the_semaphore ) \
(!(_the_semaphore))
#endif
/* end of include file */

View File

@@ -0,0 +1,53 @@
/* timer.inl
*
* This file contains the macro 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#ifndef __POSIX_TIMER_inl
#define __POSIX_TIMER_inl
/*PAGE
*
* _POSIX_Timer_Allocate
*/
#define _POSIX_Timer_Allocate() \
(POSIX_Timer_Control *) _Objects_Allocate( &_POSIX_Timer_Information )
/*PAGE
*
* _POSIX_Timer_Free
*/
#define _POSIX_Timer_Free( _the_timer ) \
_Objects_Free( &_POSIX_Timer_Information, &(_the_timer)->Object );
/*PAGE
*
* _POSIX_Timer_Get
*/
#define _POSIX_Timer_Get( _the_timer ) \
(POSIX_Timer_Control *) \
_Objects_Get( &_POSIX_Timer_Information, (_id), (_location) )
/*PAGE
*
* _POSIX_Timer_Is_null
*/
#define _POSIX_Timer_Is_null( _the_timer ) \
(!(_the_timer))
#endif
/* end of include file */