From b88fbdb4c07c538b676fce0b5115b003d29d7e43 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Fri, 23 Jan 2026 11:42:47 -0700 Subject: [PATCH] cpukit/posix: reformat include with clang-format Updates #3860. Closes #5356. --- cpukit/include/rtems/posix/aio_misc.h | 74 +++++++-------- cpukit/include/rtems/posix/barrierimpl.h | 22 ++--- cpukit/include/rtems/posix/condimpl.h | 52 +++++------ cpukit/include/rtems/posix/key.h | 30 +++--- cpukit/include/rtems/posix/keyimpl.h | 15 ++- cpukit/include/rtems/posix/mmanimpl.h | 2 +- cpukit/include/rtems/posix/mqueue.h | 30 +++--- cpukit/include/rtems/posix/mqueueimpl.h | 44 ++++----- cpukit/include/rtems/posix/muteximpl.h | 80 +++++++--------- cpukit/include/rtems/posix/posixapi.h | 14 ++- cpukit/include/rtems/posix/priorityimpl.h | 2 +- cpukit/include/rtems/posix/psignal.h | 6 +- cpukit/include/rtems/posix/psignalimpl.h | 80 +++++++++------- cpukit/include/rtems/posix/pthread.h | 4 +- cpukit/include/rtems/posix/pthreadattrimpl.h | 20 ++-- cpukit/include/rtems/posix/pthreadimpl.h | 14 +-- cpukit/include/rtems/posix/rwlockimpl.h | 20 ++-- cpukit/include/rtems/posix/semaphore.h | 26 +++--- cpukit/include/rtems/posix/semaphoreimpl.h | 40 ++++---- cpukit/include/rtems/posix/shm.h | 97 +++++++++++--------- cpukit/include/rtems/posix/shmimpl.h | 39 ++++---- cpukit/include/rtems/posix/sigset.h | 16 ++-- cpukit/include/rtems/posix/spinlockimpl.h | 4 +- cpukit/include/rtems/posix/threadsup.h | 8 +- cpukit/include/rtems/posix/timer.h | 21 ++--- cpukit/include/rtems/posix/timerimpl.h | 32 +++---- 26 files changed, 382 insertions(+), 410 deletions(-) diff --git a/cpukit/include/rtems/posix/aio_misc.h b/cpukit/include/rtems/posix/aio_misc.h index 0c74b92436..d9fea39ddb 100644 --- a/cpukit/include/rtems/posix/aio_misc.h +++ b/cpukit/include/rtems/posix/aio_misc.h @@ -42,7 +42,7 @@ #define _AIO_MISC_H #include -#include +#include #include #include #include @@ -61,23 +61,23 @@ extern "C" { /** Constants to identify op type */ /** Needed by aio_fsync() */ -#define AIO_OP_READ 0 +#define AIO_OP_READ 0 /** Needed by aio_fsync() */ -#define AIO_OP_WRITE 1 +#define AIO_OP_WRITE 1 /** Needed by aio_fsync() */ -#define AIO_OP_SYNC 2 +#define AIO_OP_SYNC 2 /** Needed by aio_fsync() */ -#define AIO_OP_DSYNC 3 +#define AIO_OP_DSYNC 3 /* * Constants to track return status */ /** The aio operation return value has been retrieved */ -#define AIO_RETURNED 0 +#define AIO_RETURNED 0 /** The aio operation return value has not been retrieved */ #define AIO_NOTRETURNED 1 @@ -85,25 +85,24 @@ extern "C" { /** Constants to identify list completion notification */ /** No notification required */ -#define AIO_LIO_NO_NOTIFY 0 +#define AIO_LIO_NO_NOTIFY 0 /** Notification via sigevent */ -#define AIO_LIO_SIGEV 1 +#define AIO_LIO_SIGEV 1 /** Notification via event delivery */ -#define AIO_LIO_EVENT 2 +#define AIO_LIO_EVENT 2 /* Constants needed by aio_suspend() */ /** Signal generated for suspend call */ -#define AIO_SIGNALED 1 +#define AIO_SIGNALED 1 /** * @brief holds a pointer to a sigevent struct or a thread id * */ -typedef union -{ +typedef union { /** @brief pointer to the sigevent for notification */ struct sigevent *sigp; @@ -115,8 +114,7 @@ typedef union /** * @brief Control block for every list enqueued with lio_listio() */ -typedef struct -{ +typedef struct { pthread_mutex_t mutex; /** @brief number of requests left to complete the list */ @@ -133,8 +131,7 @@ typedef struct /** * @brief Control block for every list involved in a aio_suspend() call. */ -typedef struct -{ +typedef struct { pthread_mutex_t mutex; /** @brief number of requests left to complete the list */ @@ -151,12 +148,11 @@ typedef struct /** * @brief The request being processed */ -typedef struct -{ +typedef struct { /** @brief Chain requests in order of priority */ rtems_chain_node next_prio; - /** @brief If _POSIX_PRIORITIZED_IO and _POSIX_PRIORITY_SCHEDULING are defined */ + /** @brief If _POSIX_PRIORITIZED_IO and _POSIX_PRIORITY_SCHEDULING are defined */ int policy; /** @brief see above */ @@ -182,8 +178,7 @@ typedef struct /** * @brief A chain of requests for the same FD */ -typedef struct -{ +typedef struct { /** @brief Order fd chains in queue */ rtems_chain_node next_fd; @@ -197,25 +192,24 @@ typedef struct int new_fd; pthread_mutex_t mutex; - pthread_cond_t cond; + pthread_cond_t cond; } rtems_aio_request_chain; /** * @brief The queue of all the requests in progress and waiting to be processed */ -typedef struct -{ +typedef struct { pthread_mutex_t mutex; - pthread_cond_t new_req; - pthread_attr_t attr; + pthread_cond_t new_req; + pthread_attr_t attr; /** @brief Chains being worked by active threads */ rtems_chain_control work_req; /** @brief Chains waiting to be processed */ rtems_chain_control idle_req; - + /** @brief Specific value if queue is initialized */ unsigned int initialized; @@ -278,8 +272,8 @@ int rtems_aio_enqueue( rtems_aio_request *req ); */ rtems_aio_request_chain *rtems_aio_search_fd( rtems_chain_control *chain, - int fildes, - int create + int fildes, + int create ); /** @@ -298,10 +292,7 @@ void rtems_aio_remove_fd( rtems_aio_request_chain *r_chain ); * @retval AIO_CANCELED The request was canceled. * @retval AIO_NOTCANCELED The request was not canceled. */ -int rtems_aio_remove_req( - rtems_chain_control *chain, - struct aiocb *aiocbp -); +int rtems_aio_remove_req( rtems_chain_control *chain, struct aiocb *aiocbp ); /** * @brief Checks the validity of a sigevent struct @@ -322,7 +313,7 @@ int rtems_aio_check_sigevent( struct sigevent *sigp ); * - * @return rtems_aio_request* a pointer to the newly created request. */ -rtems_aio_request *init_write_req( struct aiocb* aiocbp ); +rtems_aio_request *init_write_req( struct aiocb *aiocbp ); /** * @brief initializes a write rtems_aio_request @@ -332,7 +323,7 @@ rtems_aio_request *init_write_req( struct aiocb* aiocbp ); * - * @return rtems_aio_request* a pointer to the newly created request. */ -rtems_aio_request *init_read_req( struct aiocb* aiocbp ); +rtems_aio_request *init_read_req( struct aiocb *aiocbp ); /** * @brief updates listcb after op completion @@ -355,19 +346,19 @@ void rtems_aio_update_suspendcbp( rtems_aio_suspendcb *suspendcbp ); * @retval NULL The request identified by aiocbp is not present in fd_chain. * @return A pointer to the rtems_aio_request referenced by aiocbp. */ -rtems_aio_request * rtems_aio_search_in_chain( - const struct aiocb* aiocbp, +rtems_aio_request *rtems_aio_search_in_chain( + const struct aiocb *aiocbp, rtems_chain_control *fd_chain ); #ifdef RTEMS_DEBUG #include -#define AIO_assert(_x) assert(_x) -#define AIO_printf(_x) printf(_x) +#define AIO_assert( _x ) assert( _x ) +#define AIO_printf( _x ) printf( _x ) #else -#define AIO_assert(_x) -#define AIO_printf(_x) +#define AIO_assert( _x ) +#define AIO_printf( _x ) #endif #ifdef __cplusplus @@ -375,4 +366,3 @@ rtems_aio_request * rtems_aio_search_in_chain( #endif #endif - diff --git a/cpukit/include/rtems/posix/barrierimpl.h b/cpukit/include/rtems/posix/barrierimpl.h index 3c75f9f50d..e6659c74fc 100644 --- a/cpukit/include/rtems/posix/barrierimpl.h +++ b/cpukit/include/rtems/posix/barrierimpl.h @@ -55,10 +55,10 @@ extern "C" { #define POSIX_BARRIER_TQ_OPERATIONS &_Thread_queue_Operations_FIFO typedef struct { - unsigned long flags; + unsigned long flags; Thread_queue_Syslock_queue Queue; - unsigned int count; - unsigned int waiting_threads; + unsigned int count; + unsigned int waiting_threads; } POSIX_Barrier_Control; static inline POSIX_Barrier_Control *_POSIX_Barrier_Get( @@ -100,14 +100,14 @@ static inline void _POSIX_Barrier_Queue_release( ); } -#define POSIX_BARRIER_VALIDATE_OBJECT( bar ) \ - do { \ - if ( \ - ( bar ) == NULL \ - || ( (uintptr_t) ( bar ) ^ POSIX_BARRIER_MAGIC ) != ( bar )->_flags \ - ) { \ - return EINVAL; \ - } \ +#define POSIX_BARRIER_VALIDATE_OBJECT( bar ) \ + do { \ + if ( \ + ( bar ) == NULL || \ + ( (uintptr_t) ( bar ) ^ POSIX_BARRIER_MAGIC ) != ( bar )->_flags \ + ) { \ + return EINVAL; \ + } \ } while ( 0 ) #ifdef __cplusplus diff --git a/cpukit/include/rtems/posix/condimpl.h b/cpukit/include/rtems/posix/condimpl.h index c293c940f6..2853c8d244 100644 --- a/cpukit/include/rtems/posix/condimpl.h +++ b/cpukit/include/rtems/posix/condimpl.h @@ -47,9 +47,9 @@ extern "C" { #endif typedef struct { - unsigned long flags; + unsigned long flags; Thread_queue_Syslock_queue Queue; - pthread_mutex_t *mutex; + pthread_mutex_t *mutex; } POSIX_Condition_variables_Control; #define POSIX_CONDITION_VARIABLES_CLOCK_MONOTONIC 0x1UL @@ -67,17 +67,15 @@ typedef struct { #define POSIX_CONDITION_VARIABLES_TQ_OPERATIONS &_Thread_queue_Operations_FIFO #define POSIX_CONDITION_VARIABLE_OF_THREAD_QUEUE_QUEUE( queue ) \ - RTEMS_CONTAINER_OF( \ - queue, POSIX_Condition_variables_Control, Queue.Queue ) + RTEMS_CONTAINER_OF( queue, POSIX_Condition_variables_Control, Queue.Queue ) /** * The default condition variable attributes structure. */ extern const pthread_condattr_t _POSIX_Condition_variables_Default_attributes; -static inline POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get( - pthread_cond_t *cond -) +static inline POSIX_Condition_variables_Control * +_POSIX_Condition_variables_Get( pthread_cond_t *cond ) { return (POSIX_Condition_variables_Control *) cond; } @@ -158,8 +156,8 @@ static inline void _POSIX_Condition_variables_Release( * wake up version of the "signal" operation. */ int _POSIX_Condition_variables_Signal_support( - pthread_cond_t *cond, - bool is_broadcast + pthread_cond_t *cond, + bool is_broadcast ); /** @@ -169,31 +167,31 @@ int _POSIX_Condition_variables_Signal_support( * timed wait version of condition variable wait routines. */ int _POSIX_Condition_variables_Wait_support( - pthread_cond_t *cond, - pthread_mutex_t *mutex, - const struct timespec *abstime, - clockid_t clock_id + pthread_cond_t *cond, + pthread_mutex_t *mutex, + const struct timespec *abstime, + clockid_t clock_id ); bool _POSIX_Condition_variables_Auto_initialization( POSIX_Condition_variables_Control *the_cond ); -#define POSIX_CONDITION_VARIABLES_VALIDATE_OBJECT( the_cond, flags ) \ - do { \ - if ( ( the_cond ) == NULL ) { \ - return EINVAL; \ - } \ - flags = ( the_cond )->flags; \ - if ( \ - ( ( (uintptr_t) ( the_cond ) ^ POSIX_CONDITION_VARIABLES_MAGIC ) \ - & ~POSIX_CONDITION_VARIABLES_FLAGS_MASK ) \ - != ( flags & ~POSIX_CONDITION_VARIABLES_FLAGS_MASK ) \ - ) { \ +#define POSIX_CONDITION_VARIABLES_VALIDATE_OBJECT( the_cond, flags ) \ + do { \ + if ( ( the_cond ) == NULL ) { \ + return EINVAL; \ + } \ + flags = ( the_cond )->flags; \ + if ( \ + ( ( (uintptr_t) ( the_cond ) ^ POSIX_CONDITION_VARIABLES_MAGIC ) & \ + ~POSIX_CONDITION_VARIABLES_FLAGS_MASK ) != \ + ( flags & ~POSIX_CONDITION_VARIABLES_FLAGS_MASK ) \ + ) { \ if ( !_POSIX_Condition_variables_Auto_initialization( the_cond ) ) { \ - return EINVAL; \ - } \ - } \ + return EINVAL; \ + } \ + } \ } while ( 0 ) #ifdef __cplusplus diff --git a/cpukit/include/rtems/posix/key.h b/cpukit/include/rtems/posix/key.h index 465986a91f..c0d9177f70 100644 --- a/cpukit/include/rtems/posix/key.h +++ b/cpukit/include/rtems/posix/key.h @@ -111,16 +111,16 @@ extern const uint32_t _POSIX_Keys_Key_value_pair_maximum; * @brief The data structure used to manage a POSIX key. */ typedef struct { - /** This field is the Object control structure. */ - Objects_Control Object; - /** This field is the data destructor. */ - void (*destructor) (void *); + /** This field is the Object control structure. */ + Objects_Control Object; + /** This field is the data destructor. */ + void ( *destructor )( void * ); - /** + /** * @brief Key value pairs of this key. */ - Chain_Control Key_value_pairs; - } POSIX_Keys_Control; + Chain_Control Key_value_pairs; +} POSIX_Keys_Control; /** * @brief The POSIX Key objects information. @@ -136,14 +136,14 @@ extern Objects_Information _POSIX_Keys_Information; * may be set). */ #define POSIX_KEYS_INFORMATION_DEFINE( max ) \ - OBJECTS_INFORMATION_DEFINE( \ - _POSIX_Keys, \ - OBJECTS_POSIX_API, \ - OBJECTS_POSIX_KEYS, \ - POSIX_Keys_Control, \ - max, \ - OBJECTS_NO_STRING_NAME, \ - NULL \ + OBJECTS_INFORMATION_DEFINE( \ + _POSIX_Keys, \ + OBJECTS_POSIX_API, \ + OBJECTS_POSIX_KEYS, \ + POSIX_Keys_Control, \ + max, \ + OBJECTS_NO_STRING_NAME, \ + NULL \ ) /** @} */ diff --git a/cpukit/include/rtems/posix/keyimpl.h b/cpukit/include/rtems/posix/keyimpl.h index 45a7e53453..80ec88aa35 100644 --- a/cpukit/include/rtems/posix/keyimpl.h +++ b/cpukit/include/rtems/posix/keyimpl.h @@ -81,17 +81,16 @@ static inline POSIX_Keys_Control *_POSIX_Keys_Allocate( void ) * This routine frees a keys control block to the * inactive chain of free keys control blocks. */ -static inline void _POSIX_Keys_Free( - POSIX_Keys_Control *the_key -) +static inline void _POSIX_Keys_Free( POSIX_Keys_Control *the_key ) { _Objects_Free( &_POSIX_Keys_Information, &the_key->Object ); } static inline POSIX_Keys_Control *_POSIX_Keys_Get( pthread_key_t key ) { - return (POSIX_Keys_Control *) - _Objects_Get_no_protection( (Objects_Id) key, &_POSIX_Keys_Information ); + return ( + POSIX_Keys_Control * + ) _Objects_Get_no_protection( (Objects_Id) key, &_POSIX_Keys_Information ); } static inline void _POSIX_Keys_Key_value_acquire( @@ -101,7 +100,7 @@ static inline void _POSIX_Keys_Key_value_acquire( { _ISR_lock_ISR_disable_and_acquire( &the_thread->Keys.Lock, lock_context ); #ifndef RTEMS_SMP - (void) the_thread; + (void) the_thread; #endif } @@ -112,11 +111,11 @@ static inline void _POSIX_Keys_Key_value_release( { _ISR_lock_Release_and_ISR_enable( &the_thread->Keys.Lock, lock_context ); #ifndef RTEMS_SMP - (void) the_thread; + (void) the_thread; #endif } -POSIX_Keys_Key_value_pair * _POSIX_Keys_Key_value_allocate( void ); +POSIX_Keys_Key_value_pair *_POSIX_Keys_Key_value_allocate( void ); static inline void _POSIX_Keys_Key_value_free( POSIX_Keys_Key_value_pair *key_value_pair diff --git a/cpukit/include/rtems/posix/mmanimpl.h b/cpukit/include/rtems/posix/mmanimpl.h index 80dda40671..10ebd91c62 100644 --- a/cpukit/include/rtems/posix/mmanimpl.h +++ b/cpukit/include/rtems/posix/mmanimpl.h @@ -50,7 +50,7 @@ extern "C" { */ typedef struct mmap_mappings_s { rtems_chain_node node; /**< The mapping chain's node */ - void* addr; /**< The address of the mapped memory */ + void *addr; /**< The address of the mapped memory */ size_t len; /**< The length of memory mapped */ int flags; /**< The mapping flags */ POSIX_Shm_Control *shm; /**< The shared memory object or NULL */ diff --git a/cpukit/include/rtems/posix/mqueue.h b/cpukit/include/rtems/posix/mqueue.h index 4145891d7b..4051554457 100644 --- a/cpukit/include/rtems/posix/mqueue.h +++ b/cpukit/include/rtems/posix/mqueue.h @@ -74,13 +74,13 @@ extern "C" { */ typedef struct { - Objects_Control Object; - CORE_message_queue_Control Message_queue; - bool linked; - uint32_t open_count; - struct sigevent notification; - int oflag; -} POSIX_Message_queue_Control; + Objects_Control Object; + CORE_message_queue_Control Message_queue; + bool linked; + uint32_t open_count; + struct sigevent notification; + int oflag; +} POSIX_Message_queue_Control; /** * @brief The POSIX Message Queue objects information. @@ -97,14 +97,14 @@ extern Objects_Information _POSIX_Message_queue_Information; * may be set). */ #define POSIX_MESSAGE_QUEUE_INFORMATION_DEFINE( max ) \ - OBJECTS_INFORMATION_DEFINE( \ - _POSIX_Message_queue, \ - OBJECTS_POSIX_API, \ - OBJECTS_POSIX_MESSAGE_QUEUES, \ - POSIX_Message_queue_Control, \ - max, \ - _POSIX_PATH_MAX, \ - NULL \ + OBJECTS_INFORMATION_DEFINE( \ + _POSIX_Message_queue, \ + OBJECTS_POSIX_API, \ + OBJECTS_POSIX_MESSAGE_QUEUES, \ + POSIX_Message_queue_Control, \ + max, \ + _POSIX_PATH_MAX, \ + NULL \ ) /** @} */ diff --git a/cpukit/include/rtems/posix/mqueueimpl.h b/cpukit/include/rtems/posix/mqueueimpl.h index c2749db1e2..a4468a0b83 100644 --- a/cpukit/include/rtems/posix/mqueueimpl.h +++ b/cpukit/include/rtems/posix/mqueueimpl.h @@ -77,12 +77,12 @@ void _POSIX_Message_queue_Delete( * @note This code ignores the O_RDONLY/O_WRONLY/O_RDWR flag at open time. */ ssize_t _POSIX_Message_queue_Receive_support( - mqd_t mqdes, - char *msg_ptr, - size_t msg_len, - unsigned int *msg_prio, - const struct timespec *abstime, - Thread_queue_Enqueue_callout enqueue_callout + mqd_t mqdes, + char *msg_ptr, + size_t msg_len, + unsigned int *msg_prio, + const struct timespec *abstime, + Thread_queue_Enqueue_callout enqueue_callout ); /** @@ -91,19 +91,20 @@ ssize_t _POSIX_Message_queue_Receive_support( * This routine posts a message to a specified message queue. */ int _POSIX_Message_queue_Send_support( - mqd_t mqdes, - const char *msg_ptr, - size_t msg_len, - unsigned int msg_prio, - const struct timespec *abstime, - Thread_queue_Enqueue_callout enqueue_callout + mqd_t mqdes, + const char *msg_ptr, + size_t msg_len, + unsigned int msg_prio, + const struct timespec *abstime, + Thread_queue_Enqueue_callout enqueue_callout ); static inline POSIX_Message_queue_Control * - _POSIX_Message_queue_Allocate_unprotected( void ) +_POSIX_Message_queue_Allocate_unprotected( void ) { - return (POSIX_Message_queue_Control *) - _Objects_Allocate_unprotected( &_POSIX_Message_queue_Information ); + return (POSIX_Message_queue_Control *) _Objects_Allocate_unprotected( + &_POSIX_Message_queue_Information + ); } /** @@ -119,7 +120,6 @@ static inline void _POSIX_Message_queue_Free( _Objects_Free( &_POSIX_Message_queue_Information, &the_mq->Object ); } - static inline POSIX_Message_queue_Control *_POSIX_Message_queue_Get( Objects_Id id, Thread_queue_Context *queue_context @@ -140,14 +140,11 @@ static inline POSIX_Message_queue_Control *_POSIX_Message_queue_Get( * by the Score. */ static inline CORE_message_queue_Submit_types - _POSIX_Message_queue_Priority_to_core( - unsigned int priority -) +_POSIX_Message_queue_Priority_to_core( unsigned int priority ) { return (CORE_message_queue_Submit_types) priority * -1; } - /* * @brief POSIX Message Queue Convert Message Priority from Score * @@ -159,13 +156,13 @@ static inline unsigned int _POSIX_Message_queue_Priority_from_core( ) { /* absolute value without a library dependency */ - return (unsigned int) ((priority >= 0) ? priority : -priority); + return (unsigned int) ( ( priority >= 0 ) ? priority : -priority ); } /** * @brief POSIX Message Queue Remove from Namespace */ -static inline void _POSIX_Message_queue_Namespace_remove ( +static inline void _POSIX_Message_queue_Namespace_remove( POSIX_Message_queue_Control *the_mq ) { @@ -175,8 +172,7 @@ static inline void _POSIX_Message_queue_Namespace_remove ( ); } -static inline POSIX_Message_queue_Control * -_POSIX_Message_queue_Get_by_name( +static inline POSIX_Message_queue_Control *_POSIX_Message_queue_Get_by_name( const char *name, size_t *name_length_p, Objects_Get_by_name_error *error diff --git a/cpukit/include/rtems/posix/muteximpl.h b/cpukit/include/rtems/posix/muteximpl.h index 621498ca84..bed6a3bdea 100644 --- a/cpukit/include/rtems/posix/muteximpl.h +++ b/cpukit/include/rtems/posix/muteximpl.h @@ -49,9 +49,9 @@ extern "C" { #endif typedef struct { - unsigned long flags; - Mutex_recursive_Control Recursive; - Priority_Node Priority_ceiling; + unsigned long flags; + Mutex_recursive_Control Recursive; + Priority_Node Priority_ceiling; const Scheduler_Control *scheduler; } POSIX_Mutex_Control; @@ -123,12 +123,10 @@ static inline POSIX_Mutex_Protocol _POSIX_Mutex_Get_protocol( unsigned long flags ) { - return (POSIX_Mutex_Protocol) (flags & POSIX_MUTEX_PROTOCOL_MASK); + return (POSIX_Mutex_Protocol) ( flags & POSIX_MUTEX_PROTOCOL_MASK ); } -static inline bool _POSIX_Mutex_Is_recursive( - unsigned long flags -) +static inline bool _POSIX_Mutex_Is_recursive( unsigned long flags ) { return ( flags & POSIX_MUTEX_RECURSIVE ) != 0; } @@ -176,7 +174,6 @@ static Status_Control _POSIX_Mutex_Lock_nested( unsigned long flags ) { - if ( _POSIX_Mutex_Is_recursive( flags ) ) { ++the_mutex->Recursive.nest_level; return STATUS_SUCCESSFUL; @@ -269,10 +266,10 @@ static inline const Scheduler_Control *_POSIX_Mutex_Get_scheduler( const POSIX_Mutex_Control *the_mutex ) { -#if defined(RTEMS_SMP) +#if defined( RTEMS_SMP ) return the_mutex->scheduler; #else - (void) the_mutex; + (void) the_mutex; return &_Scheduler_Table[ 0 ]; #endif } @@ -315,17 +312,17 @@ static inline Status_Control _POSIX_Mutex_Ceiling_set_owner( Thread_queue_Context *queue_context ) { - ISR_lock_Context lock_context; - Scheduler_Node *scheduler_node; - Per_CPU_Control *cpu_self; + ISR_lock_Context lock_context; + Scheduler_Node *scheduler_node; + Per_CPU_Control *cpu_self; _Thread_Wait_acquire_default_critical( owner, &lock_context ); scheduler_node = _Thread_Scheduler_get_home_node( owner ); if ( - _Priority_Get_priority( &scheduler_node->Wait.Priority ) - < the_mutex->Priority_ceiling.priority + _Priority_Get_priority( &scheduler_node->Wait.Priority ) < + the_mutex->Priority_ceiling.priority ) { _Thread_Wait_release_default_critical( owner, &lock_context ); _POSIX_Mutex_Release( the_mutex, queue_context ); @@ -334,11 +331,7 @@ static inline Status_Control _POSIX_Mutex_Ceiling_set_owner( _POSIX_Mutex_Set_owner( the_mutex, owner ); _Thread_Resource_count_increment( owner ); - _Thread_Priority_add( - owner, - &the_mutex->Priority_ceiling, - queue_context - ); + _Thread_Priority_add( owner, &the_mutex->Priority_ceiling, queue_context ); _Thread_Wait_release_default_critical( owner, &lock_context ); cpu_self = _Thread_queue_Dispatch_disable( queue_context ); @@ -361,10 +354,10 @@ static inline Status_Control _POSIX_Mutex_Ceiling_seize( owner = _POSIX_Mutex_Get_owner( the_mutex ); if ( owner == NULL ) { -#if defined(RTEMS_SMP) +#if defined( RTEMS_SMP ) if ( - _Thread_Scheduler_get_home( executing ) - != _POSIX_Mutex_Get_scheduler( the_mutex ) + _Thread_Scheduler_get_home( executing ) != + _POSIX_Mutex_Get_scheduler( the_mutex ) ) { _POSIX_Mutex_Release( the_mutex, queue_context ); return STATUS_NOT_DEFINED; @@ -426,38 +419,35 @@ static inline Status_Control _POSIX_Mutex_Ceiling_surrender( ); } -#define POSIX_MUTEX_ABSTIME_TRY_LOCK ((uintptr_t) 1) +#define POSIX_MUTEX_ABSTIME_TRY_LOCK ( (uintptr_t) 1 ) int _POSIX_Mutex_Lock_support( - pthread_mutex_t *mutex, - const struct timespec *abstime, - Thread_queue_Enqueue_callout enqueue_callout + pthread_mutex_t *mutex, + const struct timespec *abstime, + Thread_queue_Enqueue_callout enqueue_callout ); -static inline POSIX_Mutex_Control *_POSIX_Mutex_Get( - pthread_mutex_t *mutex -) +static inline POSIX_Mutex_Control *_POSIX_Mutex_Get( pthread_mutex_t *mutex ) { return (POSIX_Mutex_Control *) mutex; } bool _POSIX_Mutex_Auto_initialization( POSIX_Mutex_Control *the_mutex ); -#define POSIX_MUTEX_VALIDATE_OBJECT( the_mutex, flags ) \ - do { \ - if ( ( the_mutex ) == NULL ) { \ - return EINVAL; \ - } \ - flags = ( the_mutex )->flags; \ - if ( \ - ( ( (uintptr_t) ( the_mutex ) ^ POSIX_MUTEX_MAGIC ) \ - & ~POSIX_MUTEX_FLAGS_MASK ) \ - != ( flags & ~POSIX_MUTEX_FLAGS_MASK ) \ - ) { \ - if ( !_POSIX_Mutex_Auto_initialization( the_mutex ) ) { \ - return EINVAL; \ - } \ - } \ +#define POSIX_MUTEX_VALIDATE_OBJECT( the_mutex, flags ) \ + do { \ + if ( ( the_mutex ) == NULL ) { \ + return EINVAL; \ + } \ + flags = ( the_mutex )->flags; \ + if ( \ + ( ( (uintptr_t) ( the_mutex ) ^ POSIX_MUTEX_MAGIC ) & \ + ~POSIX_MUTEX_FLAGS_MASK ) != ( flags & ~POSIX_MUTEX_FLAGS_MASK ) \ + ) { \ + if ( !_POSIX_Mutex_Auto_initialization( the_mutex ) ) { \ + return EINVAL; \ + } \ + } \ } while ( 0 ) #ifdef __cplusplus diff --git a/cpukit/include/rtems/posix/posixapi.h b/cpukit/include/rtems/posix/posixapi.h index 028e84adb0..1eb1aad69d 100644 --- a/cpukit/include/rtems/posix/posixapi.h +++ b/cpukit/include/rtems/posix/posixapi.h @@ -59,11 +59,11 @@ extern const int _POSIX_Get_by_name_error_table[ 3 ]; -static inline int _POSIX_Get_by_name_error( - Objects_Get_by_name_error error -) +static inline int _POSIX_Get_by_name_error( Objects_Get_by_name_error error ) { - _Assert( (size_t) error < RTEMS_ARRAY_SIZE( _POSIX_Get_by_name_error_table ) ); + _Assert( + (size_t) error < RTEMS_ARRAY_SIZE( _POSIX_Get_by_name_error_table ) + ); return _POSIX_Get_by_name_error_table[ error ]; } @@ -79,9 +79,7 @@ static inline int _POSIX_Get_error_after_wait( return _POSIX_Get_error( _Thread_Wait_get_status( executing ) ); } -static inline int _POSIX_Zero_or_minus_one_plus_errno( - Status_Control status -) +static inline int _POSIX_Zero_or_minus_one_plus_errno( Status_Control status ) { if ( status == STATUS_SUCCESSFUL ) { return 0; @@ -100,7 +98,7 @@ static inline int _POSIX_Zero_or_minus_one_plus_errno( static inline bool _POSIX_Is_valid_pshared( int pshared ) { return pshared == PTHREAD_PROCESS_PRIVATE || - pshared == PTHREAD_PROCESS_SHARED; + pshared == PTHREAD_PROCESS_SHARED; } /** diff --git a/cpukit/include/rtems/posix/priorityimpl.h b/cpukit/include/rtems/posix/priorityimpl.h index 2cb1bb22fc..4f4d27bafa 100644 --- a/cpukit/include/rtems/posix/priorityimpl.h +++ b/cpukit/include/rtems/posix/priorityimpl.h @@ -58,7 +58,7 @@ extern "C" { /** * This is the numerically least important POSIX priority. */ -#define POSIX_SCHEDULER_MINIMUM_PRIORITY (1) +#define POSIX_SCHEDULER_MINIMUM_PRIORITY ( 1 ) /** * @brief Gets the maximum POSIX API priority for this scheduler instance. diff --git a/cpukit/include/rtems/posix/psignal.h b/cpukit/include/rtems/posix/psignal.h index de4848e000..3cdce4a9e6 100644 --- a/cpukit/include/rtems/posix/psignal.h +++ b/cpukit/include/rtems/posix/psignal.h @@ -46,9 +46,9 @@ */ typedef struct { - Chain_Node Node; - siginfo_t Info; -} POSIX_signals_Siginfo_node; + Chain_Node Node; + siginfo_t Info; +} POSIX_signals_Siginfo_node; extern const uint32_t _POSIX_signals_Maximum_queued_signals; diff --git a/cpukit/include/rtems/posix/psignalimpl.h b/cpukit/include/rtems/posix/psignalimpl.h index 16c9b38607..32174c32b9 100644 --- a/cpukit/include/rtems/posix/psignalimpl.h +++ b/cpukit/include/rtems/posix/psignalimpl.h @@ -56,27 +56,47 @@ #define POSIX_SIGNALS_TQ_OPERATIONS &_Thread_queue_Operations_FIFO -#define _States_Is_interruptible_signal( _states ) \ - ( ((_states) & \ - (STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL)) == \ - (STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL)) +#define _States_Is_interruptible_signal( _states ) \ + ( ( ( _states ) & \ + ( STATES_WAITING_FOR_SIGNAL | STATES_INTERRUPTIBLE_BY_SIGNAL ) ) == \ + ( STATES_WAITING_FOR_SIGNAL | STATES_INTERRUPTIBLE_BY_SIGNAL ) ) -#define SIGACTION_TERMINATE \ - { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Abnormal_termination_handler} } +#define SIGACTION_TERMINATE \ + { \ + 0, SIGNAL_ALL_MASK, \ + { \ + _POSIX_signals_Abnormal_termination_handler \ + } \ + } #define SIGACTION_IGNORE \ - { 0, SIGNAL_ALL_MASK, {SIG_IGN} } -#define SIGACTION_STOP \ - { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Stop_handler} } -#define SIGACTION_CONTINUE \ - { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Continue_handler} } + { \ + 0, SIGNAL_ALL_MASK, \ + { \ + SIG_IGN \ + } \ + } +#define SIGACTION_STOP \ + { \ + 0, SIGNAL_ALL_MASK, \ + { \ + _POSIX_signals_Stop_handler \ + } \ + } +#define SIGACTION_CONTINUE \ + { \ + 0, SIGNAL_ALL_MASK, \ + { \ + _POSIX_signals_Continue_handler \ + } \ + } -#define SIG_ARRAY_MAX (SIGRTMAX + 1) +#define SIG_ARRAY_MAX ( SIGRTMAX + 1 ) /* * Variables */ -extern sigset_t _POSIX_signals_Pending; +extern sigset_t _POSIX_signals_Pending; extern const struct sigaction _POSIX_signals_Default_vectors[ SIG_ARRAY_MAX ]; @@ -110,45 +130,37 @@ static inline void _POSIX_signals_Release( * @brief Unlock POSIX signals thread. */ bool _POSIX_signals_Unblock_thread( - Thread_Control *the_thread, - int signo, - siginfo_t *info + Thread_Control *the_thread, + int signo, + siginfo_t *info ); /** * @brief Clear POSIX signals. */ bool _POSIX_signals_Clear_signals( - POSIX_API_Control *api, - int signo, - siginfo_t *info, - bool is_global, - bool check_blocked, - bool do_signals_acquire_release + POSIX_API_Control *api, + int signo, + siginfo_t *info, + bool is_global, + bool check_blocked, + bool do_signals_acquire_release ); -int _POSIX_signals_Send( - pid_t pid, - int sig, - const union sigval *value -); +int _POSIX_signals_Send( pid_t pid, int sig, const union sigval *value ); /** * @brief Set POSIX process signals. */ -void _POSIX_signals_Set_process_signals( - sigset_t mask -); +void _POSIX_signals_Set_process_signals( sigset_t mask ); -void _POSIX_signals_Clear_process_signals( - int signo -); +void _POSIX_signals_Clear_process_signals( int signo ); /* * Default signal handlers */ -#define _POSIX_signals_Stop_handler NULL +#define _POSIX_signals_Stop_handler NULL #define _POSIX_signals_Continue_handler NULL void _POSIX_signals_Abnormal_termination_handler( int signo ); diff --git a/cpukit/include/rtems/posix/pthread.h b/cpukit/include/rtems/posix/pthread.h index b76c61159e..6af9c12a03 100644 --- a/cpukit/include/rtems/posix/pthread.h +++ b/cpukit/include/rtems/posix/pthread.h @@ -61,9 +61,9 @@ extern "C" { */ typedef struct { /** This is the entry point for a POSIX initialization thread. */ - void *(*thread_entry)(void *); + void *( *thread_entry )( void * ); /** This is the stack size for a POSIX initialization thread. */ - int stack_size; + int stack_size; } posix_initialization_threads_table; extern const size_t _POSIX_Threads_Minimum_stack_size; diff --git a/cpukit/include/rtems/posix/pthreadattrimpl.h b/cpukit/include/rtems/posix/pthreadattrimpl.h index 726519c690..10099e45cd 100644 --- a/cpukit/include/rtems/posix/pthreadattrimpl.h +++ b/cpukit/include/rtems/posix/pthreadattrimpl.h @@ -61,25 +61,20 @@ extern "C" { extern const pthread_attr_t _POSIX_Threads_Default_attributes; static inline void _POSIX_Threads_Copy_attributes( - pthread_attr_t *dst_attr, - const pthread_attr_t *src_attr + pthread_attr_t *dst_attr, + const pthread_attr_t *src_attr ) { *dst_attr = *src_attr; _Assert( - dst_attr->affinitysetsize == sizeof(dst_attr->affinitysetpreallocated) + dst_attr->affinitysetsize == sizeof( dst_attr->affinitysetpreallocated ) ); dst_attr->affinityset = &dst_attr->affinitysetpreallocated; } -static inline void _POSIX_Threads_Initialize_attributes( - pthread_attr_t *attr -) +static inline void _POSIX_Threads_Initialize_attributes( pthread_attr_t *attr ) { - _POSIX_Threads_Copy_attributes( - attr, - &_POSIX_Threads_Default_attributes - ); + _POSIX_Threads_Copy_attributes( attr, &_POSIX_Threads_Default_attributes ); } static inline void _POSIX_Threads_Get_sched_param_sporadic( @@ -88,10 +83,11 @@ static inline void _POSIX_Threads_Get_sched_param_sporadic( struct sched_param *param ) { -#if defined(RTEMS_POSIX_API) +#if defined( RTEMS_POSIX_API ) const POSIX_API_Control *api; - api = (const POSIX_API_Control*) the_thread->API_Extensions[ THREAD_API_POSIX ]; + api = (const POSIX_API_Control *) + the_thread->API_Extensions[ THREAD_API_POSIX ]; param->sched_ss_low_priority = _POSIX_Priority_From_core( scheduler, api->Sporadic.Low_priority.priority diff --git a/cpukit/include/rtems/posix/pthreadimpl.h b/cpukit/include/rtems/posix/pthreadimpl.h index 3e76f2792a..48e7bb3184 100644 --- a/cpukit/include/rtems/posix/pthreadimpl.h +++ b/cpukit/include/rtems/posix/pthreadimpl.h @@ -60,14 +60,15 @@ extern "C" { */ #define PTHREAD_MINIMUM_STACK_SIZE _POSIX_Threads_Minimum_stack_size -#if defined(RTEMS_POSIX_API) +#if defined( RTEMS_POSIX_API ) static inline void _POSIX_Threads_Sporadic_timer_insert( Thread_Control *the_thread, POSIX_API_Control *api ) { - the_thread->CPU_budget.available = - _Timespec_To_ticks( &api->Sporadic.sched_ss_init_budget ); + the_thread->CPU_budget.available = _Timespec_To_ticks( + &api->Sporadic.sched_ss_init_budget + ); _Watchdog_Per_CPU_insert_ticks( &api->Sporadic.Timer, @@ -109,14 +110,15 @@ int _POSIX_Thread_Translate_sched_param( Thread_Configuration *config ); -static inline Thread_Control *_POSIX_Threads_Allocate(void) +static inline Thread_Control *_POSIX_Threads_Allocate( void ) { _Objects_Allocator_lock(); _Thread_Kill_zombies(); - return (Thread_Control *) - _Objects_Allocate_unprotected( &_POSIX_Threads_Information.Objects ); + return (Thread_Control *) _Objects_Allocate_unprotected( + &_POSIX_Threads_Information.Objects + ); } /** @} */ diff --git a/cpukit/include/rtems/posix/rwlockimpl.h b/cpukit/include/rtems/posix/rwlockimpl.h index f17967b1f6..86e0a82ba9 100644 --- a/cpukit/include/rtems/posix/rwlockimpl.h +++ b/cpukit/include/rtems/posix/rwlockimpl.h @@ -50,7 +50,7 @@ extern "C" { #define POSIX_RWLOCK_MAGIC 0x9621dabdUL typedef struct { - unsigned long flags; + unsigned long flags; CORE_RWLock_Control RWLock; } POSIX_RWLock_Control; @@ -63,16 +63,16 @@ static inline POSIX_RWLock_Control *_POSIX_RWLock_Get( bool _POSIX_RWLock_Auto_initialization( POSIX_RWLock_Control *the_rwlock ); -#define POSIX_RWLOCK_VALIDATE_OBJECT( rw ) \ - do { \ - if ( ( rw ) == NULL ) { \ - return EINVAL; \ - } \ +#define POSIX_RWLOCK_VALIDATE_OBJECT( rw ) \ + do { \ + if ( ( rw ) == NULL ) { \ + return EINVAL; \ + } \ if ( ( (uintptr_t) ( rw ) ^ POSIX_RWLOCK_MAGIC ) != ( rw )->flags ) { \ - if ( !_POSIX_RWLock_Auto_initialization( rw ) ) { \ - return EINVAL; \ - } \ - } \ + if ( !_POSIX_RWLock_Auto_initialization( rw ) ) { \ + return EINVAL; \ + } \ + } \ } while ( 0 ) #ifdef __cplusplus diff --git a/cpukit/include/rtems/posix/semaphore.h b/cpukit/include/rtems/posix/semaphore.h index cce16a2ca2..d7b8ddc35e 100644 --- a/cpukit/include/rtems/posix/semaphore.h +++ b/cpukit/include/rtems/posix/semaphore.h @@ -61,11 +61,11 @@ extern "C" { */ typedef struct { - Objects_Control Object; - sem_t Semaphore; - bool linked; - uint32_t open_count; -} POSIX_Semaphore_Control; + Objects_Control Object; + sem_t Semaphore; + bool linked; + uint32_t open_count; +} POSIX_Semaphore_Control; /** * @brief The POSIX Semaphore objects information. @@ -82,14 +82,14 @@ extern Objects_Information _POSIX_Semaphore_Information; * may be set). */ #define POSIX_SEMAPHORE_INFORMATION_DEFINE( max ) \ - OBJECTS_INFORMATION_DEFINE( \ - _POSIX_Semaphore, \ - OBJECTS_POSIX_API, \ - OBJECTS_POSIX_SEMAPHORES, \ - POSIX_Semaphore_Control, \ - max, \ - _POSIX_PATH_MAX, \ - NULL \ + OBJECTS_INFORMATION_DEFINE( \ + _POSIX_Semaphore, \ + OBJECTS_POSIX_API, \ + OBJECTS_POSIX_SEMAPHORES, \ + POSIX_Semaphore_Control, \ + max, \ + _POSIX_PATH_MAX, \ + NULL \ ) /** @} */ diff --git a/cpukit/include/rtems/posix/semaphoreimpl.h b/cpukit/include/rtems/posix/semaphoreimpl.h index 7f322c21c0..710b43a721 100644 --- a/cpukit/include/rtems/posix/semaphoreimpl.h +++ b/cpukit/include/rtems/posix/semaphoreimpl.h @@ -53,11 +53,13 @@ extern "C" { */ #define POSIX_SEMAPHORE_MAGIC 0x5d367fe7UL -static inline POSIX_Semaphore_Control * - _POSIX_Semaphore_Allocate_unprotected( void ) +static inline POSIX_Semaphore_Control *_POSIX_Semaphore_Allocate_unprotected( + void +) { - return (POSIX_Semaphore_Control *) - _Objects_Allocate_unprotected( &_POSIX_Semaphore_Information ); + return (POSIX_Semaphore_Control *) _Objects_Allocate_unprotected( + &_POSIX_Semaphore_Information + ); } /** @@ -66,16 +68,14 @@ static inline POSIX_Semaphore_Control * * This routine frees a semaphore control block to the * inactive chain of free semaphore control blocks. */ -static inline void _POSIX_Semaphore_Free ( +static inline void _POSIX_Semaphore_Free( POSIX_Semaphore_Control *the_semaphore ) { _Objects_Free( &_POSIX_Semaphore_Information, &the_semaphore->Object ); } -static inline POSIX_Semaphore_Control *_POSIX_Semaphore_Get( - sem_t *sem -) +static inline POSIX_Semaphore_Control *_POSIX_Semaphore_Get( sem_t *sem ) { return RTEMS_CONTAINER_OF( sem, POSIX_Semaphore_Control, Semaphore ); } @@ -91,9 +91,9 @@ static inline bool _POSIX_Semaphore_Is_busy( const sem_t *sem ) } static inline void _POSIX_Semaphore_Initialize( - sem_t *sem, - const char *name, - unsigned int value + sem_t *sem, + const char *name, + unsigned int value ) { sem->_flags = (uintptr_t) sem ^ POSIX_SEMAPHORE_MAGIC; @@ -116,7 +116,7 @@ void _POSIX_Semaphore_Delete( POSIX_Semaphore_Control *the_semaphore ); /** * @brief POSIX Semaphore Namespace Remove */ -static inline void _POSIX_Semaphore_Namespace_remove ( +static inline void _POSIX_Semaphore_Namespace_remove( POSIX_Semaphore_Control *the_semaphore ) { @@ -140,14 +140,14 @@ static inline POSIX_Semaphore_Control *_POSIX_Semaphore_Get_by_name( ); } -#define POSIX_SEMAPHORE_VALIDATE_OBJECT( sem ) \ - do { \ - if ( \ - ( sem ) == NULL \ - || ( (uintptr_t) ( sem ) ^ POSIX_SEMAPHORE_MAGIC ) != ( sem )->_flags \ - ) { \ - rtems_set_errno_and_return_minus_one( EINVAL ); \ - } \ +#define POSIX_SEMAPHORE_VALIDATE_OBJECT( sem ) \ + do { \ + if ( \ + ( sem ) == NULL || \ + ( (uintptr_t) ( sem ) ^ POSIX_SEMAPHORE_MAGIC ) != ( sem )->_flags \ + ) { \ + rtems_set_errno_and_return_minus_one( EINVAL ); \ + } \ } while ( 0 ) #ifdef __cplusplus diff --git a/cpukit/include/rtems/posix/shm.h b/cpukit/include/rtems/posix/shm.h index f2985f4874..c52c25470b 100644 --- a/cpukit/include/rtems/posix/shm.h +++ b/cpukit/include/rtems/posix/shm.h @@ -52,7 +52,7 @@ extern "C" { * @{ */ typedef struct POSIX_Shm_Object_operations POSIX_Shm_Object_operations; -extern const POSIX_Shm_Object_operations _POSIX_Shm_Object_operations; +extern const POSIX_Shm_Object_operations _POSIX_Shm_Object_operations; /** * @brief Encapsulation for the storage and manipulation of shm objects. @@ -61,18 +61,18 @@ typedef struct { /** * @brief The handle is private for finding object storage. */ - void *handle; + void *handle; /** * @brief The number of bytes allocated to the object. A size of 0 with * a handle of NULL means no object is allocated. */ - size_t size; + size_t size; /** * @brief Implementation-specific operations on shm objects. */ - const POSIX_Shm_Object_operations *ops; + const POSIX_Shm_Object_operations *ops; } POSIX_Shm_Object; /** @@ -86,7 +86,7 @@ struct POSIX_Shm_Object_operations { * * Returns 0 for success. */ - int ( *object_create ) ( POSIX_Shm_Object *shm_obj, size_t size ); + int ( *object_create )( POSIX_Shm_Object *shm_obj, size_t size ); /** * @brief Changes the @a shm_obj size to @a size. @@ -95,7 +95,7 @@ struct POSIX_Shm_Object_operations { * * Returns 0 for success. */ - int ( *object_resize ) ( POSIX_Shm_Object *shm_obj, size_t size ); + int ( *object_resize )( POSIX_Shm_Object *shm_obj, size_t size ); /** * @brief Deletes the @a shm_obj. @@ -104,14 +104,14 @@ struct POSIX_Shm_Object_operations { * * Returns 0 for success. */ - int ( *object_delete ) ( POSIX_Shm_Object *shm_obj ); + int ( *object_delete )( POSIX_Shm_Object *shm_obj ); /** * @brief Copies up to @count bytes of the @a shm_obj data into @a buf. * * Returns the number of bytes read (copied) into @a buf. */ - int ( *object_read ) ( POSIX_Shm_Object *shm_obj, void *buf, size_t count ); + int ( *object_read )( POSIX_Shm_Object *shm_obj, void *buf, size_t count ); /** * @brief Maps a shared memory object. @@ -121,28 +121,33 @@ struct POSIX_Shm_Object_operations { * * Returns the mapped address of the object. */ - void * ( *object_mmap ) ( POSIX_Shm_Object *shm_obj, size_t len, int prot, off_t off); + void *( *object_mmap )( + POSIX_Shm_Object *shm_obj, + size_t len, + int prot, + off_t off + ); }; /** * @brief Control for a POSIX Shared Memory Object */ typedef struct { - Objects_Control Object; - Thread_queue_Control Wait_queue; + Objects_Control Object; + Thread_queue_Control Wait_queue; - int reference_count; + int reference_count; - POSIX_Shm_Object shm_object; + POSIX_Shm_Object shm_object; - uid_t uid; - gid_t gid; - mode_t mode; - int oflag; + uid_t uid; + gid_t gid; + mode_t mode; + int oflag; - time_t atime; - time_t mtime; - time_t ctime; + time_t atime; + time_t mtime; + time_t ctime; } POSIX_Shm_Control; /** @@ -160,14 +165,14 @@ extern Objects_Information _POSIX_Shm_Information; * may be set). */ #define POSIX_SHM_INFORMATION_DEFINE( max ) \ - OBJECTS_INFORMATION_DEFINE( \ - _POSIX_Shm, \ - OBJECTS_POSIX_API, \ - OBJECTS_POSIX_SHMS, \ - POSIX_Shm_Control, \ - max, \ - _POSIX_PATH_MAX, \ - NULL \ + OBJECTS_INFORMATION_DEFINE( \ + _POSIX_Shm, \ + OBJECTS_POSIX_API, \ + OBJECTS_POSIX_SHMS, \ + POSIX_Shm_Control, \ + max, \ + _POSIX_PATH_MAX, \ + NULL \ ) /** @@ -175,20 +180,22 @@ extern Objects_Information _POSIX_Shm_Information; */ extern int _POSIX_Shm_Object_create_from_workspace( POSIX_Shm_Object *shm_obj, - size_t size + size_t size ); /** * @brief object_delete operation for shm objects stored in RTEMS Workspace. */ -extern int _POSIX_Shm_Object_delete_from_workspace( POSIX_Shm_Object *shm_obj ); +extern int _POSIX_Shm_Object_delete_from_workspace( + POSIX_Shm_Object *shm_obj +); /** * @brief object_resize operation for shm objects stored in RTEMS Workspace. */ extern int _POSIX_Shm_Object_resize_from_workspace( POSIX_Shm_Object *shm_obj, - size_t size + size_t size ); /** @@ -196,18 +203,18 @@ extern int _POSIX_Shm_Object_resize_from_workspace( */ extern int _POSIX_Shm_Object_read_from_workspace( POSIX_Shm_Object *shm_obj, - void *buf, - size_t count + void *buf, + size_t count ); /** * @brief object_mmap operation for shm objects stored in RTEMS Workspace. */ -extern void * _POSIX_Shm_Object_mmap_from_workspace( +extern void *_POSIX_Shm_Object_mmap_from_workspace( POSIX_Shm_Object *shm_obj, - size_t len, - int prot, - off_t off + size_t len, + int prot, + off_t off ); /** @@ -215,7 +222,7 @@ extern void * _POSIX_Shm_Object_mmap_from_workspace( */ extern int _POSIX_Shm_Object_create_from_heap( POSIX_Shm_Object *shm_obj, - size_t size + size_t size ); /** @@ -228,7 +235,7 @@ extern int _POSIX_Shm_Object_delete_from_heap( POSIX_Shm_Object *shm_obj ); */ extern int _POSIX_Shm_Object_resize_from_heap( POSIX_Shm_Object *shm_obj, - size_t size + size_t size ); /** @@ -236,18 +243,18 @@ extern int _POSIX_Shm_Object_resize_from_heap( */ extern int _POSIX_Shm_Object_read_from_heap( POSIX_Shm_Object *shm_obj, - void *buf, - size_t count + void *buf, + size_t count ); /** * @brief object_mmap operation for shm objects stored in C program heap. */ -extern void * _POSIX_Shm_Object_mmap_from_heap( +extern void *_POSIX_Shm_Object_mmap_from_heap( POSIX_Shm_Object *shm_obj, - size_t len, - int prot, - off_t off + size_t len, + int prot, + off_t off ); /** @} */ diff --git a/cpukit/include/rtems/posix/shmimpl.h b/cpukit/include/rtems/posix/shmimpl.h index b5f8847b0c..8665ff1852 100644 --- a/cpukit/include/rtems/posix/shmimpl.h +++ b/cpukit/include/rtems/posix/shmimpl.h @@ -52,8 +52,9 @@ extern "C" { static inline POSIX_Shm_Control *_POSIX_Shm_Allocate_unprotected( void ) { - return (POSIX_Shm_Control *) - _Objects_Allocate_unprotected( &_POSIX_Shm_Information ); + return (POSIX_Shm_Control *) _Objects_Allocate_unprotected( + &_POSIX_Shm_Information + ); } /** @@ -61,9 +62,7 @@ static inline POSIX_Shm_Control *_POSIX_Shm_Allocate_unprotected( void ) * * This routine frees a shm control block. */ -static inline void _POSIX_Shm_Free ( - POSIX_Shm_Control *the_shm -) +static inline void _POSIX_Shm_Free( POSIX_Shm_Control *the_shm ) { _Objects_Free( &_POSIX_Shm_Information, &the_shm->Object ); } @@ -82,18 +81,14 @@ static inline POSIX_Shm_Control *_POSIX_Shm_Get_by_name( ); } -static inline void _POSIX_Shm_Update_atime( - POSIX_Shm_Control *shm -) +static inline void _POSIX_Shm_Update_atime( POSIX_Shm_Control *shm ) { struct timeval now; gettimeofday( &now, 0 ); shm->atime = now.tv_sec; } -static inline void _POSIX_Shm_Update_mtime_ctime( - POSIX_Shm_Control *shm -) +static inline void _POSIX_Shm_Update_mtime_ctime( POSIX_Shm_Control *shm ) { struct timeval now; gettimeofday( &now, 0 ); @@ -101,32 +96,30 @@ static inline void _POSIX_Shm_Update_mtime_ctime( shm->ctime = now.tv_sec; } -static inline POSIX_Shm_Control* iop_to_shm( rtems_libio_t *iop ) +static inline POSIX_Shm_Control *iop_to_shm( rtems_libio_t *iop ) { - return (POSIX_Shm_Control*) iop->data1; + return (POSIX_Shm_Control *) iop->data1; } -static inline POSIX_Shm_Control* loc_to_shm( - const rtems_filesystem_location_info_t *loc +static inline POSIX_Shm_Control *loc_to_shm( + const rtems_filesystem_location_info_t *loc ) { - return (POSIX_Shm_Control*) loc->node_access; + return (POSIX_Shm_Control *) loc->node_access; } -static inline int POSIX_Shm_Attempt_delete( - POSIX_Shm_Control* shm -) +static inline int POSIX_Shm_Attempt_delete( POSIX_Shm_Control *shm ) { - Objects_Control *obj; - ISR_lock_Context lock_ctx; - int err; + Objects_Control *obj; + ISR_lock_Context lock_ctx; + int err; err = 0; _Objects_Allocator_lock(); --shm->reference_count; if ( shm->reference_count == 0 ) { - if ( (*shm->shm_object.ops->object_delete)( &shm->shm_object ) != 0 ) { + if ( ( *shm->shm_object.ops->object_delete )( &shm->shm_object ) != 0 ) { err = EIO; } } diff --git a/cpukit/include/rtems/posix/sigset.h b/cpukit/include/rtems/posix/sigset.h index 0fcd8da464..358ccf4cd9 100644 --- a/cpukit/include/rtems/posix/sigset.h +++ b/cpukit/include/rtems/posix/sigset.h @@ -45,21 +45,17 @@ * Currently 32 signals numbered 1-32 are defined */ -#define SIGNAL_EMPTY_MASK 0x00000000L -#define SIGNAL_ALL_MASK 0xffffffffL +#define SIGNAL_EMPTY_MASK 0x00000000L +#define SIGNAL_ALL_MASK 0xffffffffL -static inline sigset_t signo_to_mask( - uint32_t sig -) +static inline sigset_t signo_to_mask( uint32_t sig ) { - return 1u << (sig - 1); + return 1u << ( sig - 1 ); } -static inline bool is_valid_signo( - int signo -) +static inline bool is_valid_signo( int signo ) { - return ((signo) >= 1 && (signo) <= 32 ); + return ( ( signo ) >= 1 && ( signo ) <= 32 ); } #endif diff --git a/cpukit/include/rtems/posix/spinlockimpl.h b/cpukit/include/rtems/posix/spinlockimpl.h index 10424f1961..29193f7d9d 100644 --- a/cpukit/include/rtems/posix/spinlockimpl.h +++ b/cpukit/include/rtems/posix/spinlockimpl.h @@ -44,7 +44,7 @@ #include -#if defined(RTEMS_SMP) +#if defined( RTEMS_SMP ) #include #include #endif @@ -54,7 +54,7 @@ extern "C" { #endif typedef struct { -#if defined(RTEMS_SMP) +#if defined( RTEMS_SMP ) SMP_ticket_lock_Control Lock; #else unsigned int reserved[ 2 ]; diff --git a/cpukit/include/rtems/posix/threadsup.h b/cpukit/include/rtems/posix/threadsup.h index 95f56abb12..b256f03f9e 100644 --- a/cpukit/include/rtems/posix/threadsup.h +++ b/cpukit/include/rtems/posix/threadsup.h @@ -54,7 +54,7 @@ extern "C" { #endif -#if defined(RTEMS_POSIX_API) +#if defined( RTEMS_POSIX_API ) /** * This defines the POSIX API support structure associated with * each thread in a system with POSIX configured. @@ -98,14 +98,14 @@ typedef struct { } Sporadic; /** This is the set of signals which are currently unblocked. */ - sigset_t signals_unblocked; + sigset_t signals_unblocked; /** This is the set of signals which are currently pending. */ - sigset_t signals_pending; + sigset_t signals_pending; /** * @brief Signal post-switch action in case signals are pending. */ - Thread_Action Signal_action; + Thread_Action Signal_action; } POSIX_API_Control; #endif diff --git a/cpukit/include/rtems/posix/timer.h b/cpukit/include/rtems/posix/timer.h index 86b45ba05d..fd79f87c4b 100644 --- a/cpukit/include/rtems/posix/timer.h +++ b/cpukit/include/rtems/posix/timer.h @@ -84,14 +84,14 @@ extern Objects_Information _POSIX_Timer_Information; * may be set). */ #define POSIX_TIMER_INFORMATION_DEFINE( max ) \ - OBJECTS_INFORMATION_DEFINE( \ - _POSIX_Timer, \ - OBJECTS_POSIX_API, \ - OBJECTS_POSIX_TIMERS, \ - POSIX_Timer_Control, \ - max, \ - OBJECTS_NO_STRING_NAME, \ - NULL \ + OBJECTS_INFORMATION_DEFINE( \ + _POSIX_Timer, \ + OBJECTS_POSIX_API, \ + OBJECTS_POSIX_TIMERS, \ + POSIX_Timer_Control, \ + max, \ + OBJECTS_NO_STRING_NAME, \ + NULL \ ) /** @@ -107,10 +107,7 @@ extern Objects_Information _POSIX_Timer_Information; * * @return 0 if @a clock_id is allowed for use. Otherwise an errno value. */ -int _POSIX_Timer_Is_allowed( - clockid_t clock_id -); - +int _POSIX_Timer_Is_allowed( clockid_t clock_id ); /** @} */ diff --git a/cpukit/include/rtems/posix/timerimpl.h b/cpukit/include/rtems/posix/timerimpl.h index f0622b6026..bf43a1bf2e 100644 --- a/cpukit/include/rtems/posix/timerimpl.h +++ b/cpukit/include/rtems/posix/timerimpl.h @@ -47,26 +47,26 @@ extern "C" { #endif /** Timer is free */ -#define POSIX_TIMER_STATE_FREE 0x01 +#define POSIX_TIMER_STATE_FREE 0x01 /** Created timer but not running */ -#define POSIX_TIMER_STATE_CREATE_NEW 0x02 +#define POSIX_TIMER_STATE_CREATE_NEW 0x02 /** Created timer and running */ -#define POSIX_TIMER_STATE_CREATE_RUN 0x03 +#define POSIX_TIMER_STATE_CREATE_RUN 0x03 /** Created, ran and stopped timer */ #define POSIX_TIMER_STATE_CREATE_STOP 0x04 /** Indicates that the fire time is relative to the current one */ -#define POSIX_TIMER_RELATIVE 0 +#define POSIX_TIMER_RELATIVE 0 /* * POSIX defines TIMER_ABSTIME but no constant for relative. So * we have one internally but we need to be careful it has a different * value. */ -#if (POSIX_TIMER_RELATIVE == TIMER_ABSTIME) +#if ( POSIX_TIMER_RELATIVE == TIMER_ABSTIME ) #error "POSIX_TIMER_RELATIVE == TIMER_ABSTIME" #endif @@ -78,7 +78,9 @@ extern "C" { */ static inline POSIX_Timer_Control *_POSIX_Timer_Allocate( void ) { - return (POSIX_Timer_Control *) _Objects_Allocate( &_POSIX_Timer_Information ); + return (POSIX_Timer_Control *) _Objects_Allocate( + &_POSIX_Timer_Information + ); } /** @@ -87,9 +89,7 @@ static inline POSIX_Timer_Control *_POSIX_Timer_Allocate( void ) * This routine frees a timer control block to the * inactive chain of free timer control blocks. */ -static inline void _POSIX_Timer_Free ( - POSIX_Timer_Control *the_timer -) +static inline void _POSIX_Timer_Free( POSIX_Timer_Control *the_timer ) { _Objects_Free( &_POSIX_Timer_Information, &the_timer->Object ); } @@ -105,16 +105,14 @@ void _POSIX_Timer_TSR( Watchdog_Control *the_watchdog ); * is set to OBJECTS_LOCAL. Otherwise, location is set * to OBJECTS_ERROR and the returned value is undefined. */ -static inline POSIX_Timer_Control *_POSIX_Timer_Get ( - timer_t id, - ISR_lock_Context *lock_context +static inline POSIX_Timer_Control *_POSIX_Timer_Get( + timer_t id, + ISR_lock_Context *lock_context ) { - return (POSIX_Timer_Control *) _Objects_Get( - (Objects_Id) id, - lock_context, - &_POSIX_Timer_Information - ); + return ( + POSIX_Timer_Control * + ) _Objects_Get( (Objects_Id) id, lock_context, &_POSIX_Timer_Information ); } static inline Per_CPU_Control *_POSIX_Timer_Acquire_critical(