From 242887bc5698ac84261625013cc39112d2ce38eb Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 13 Sep 2018 06:19:05 +0200 Subject: Rename files to make them unique within cpukit This allows to build librtemscpu.a in one rush in the future. --- cpukit/posix/Makefile.am | 4 +- cpukit/posix/src/psxsemaphore.c | 59 ++++++++++++++++++++++ cpukit/posix/src/psxtimercreate.c | 101 ++++++++++++++++++++++++++++++++++++++ cpukit/posix/src/psxtimerdelete.c | 71 +++++++++++++++++++++++++++ cpukit/posix/src/semaphore.c | 59 ---------------------- cpukit/posix/src/timercreate.c | 101 -------------------------------------- cpukit/posix/src/timerdelete.c | 71 --------------------------- 7 files changed, 233 insertions(+), 233 deletions(-) create mode 100644 cpukit/posix/src/psxsemaphore.c create mode 100644 cpukit/posix/src/psxtimercreate.c create mode 100644 cpukit/posix/src/psxtimerdelete.c delete mode 100644 cpukit/posix/src/semaphore.c delete mode 100644 cpukit/posix/src/timercreate.c delete mode 100644 cpukit/posix/src/timerdelete.c (limited to 'cpukit/posix') diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am index 5935efa568..12d7c0def4 100644 --- a/cpukit/posix/Makefile.am +++ b/cpukit/posix/Makefile.am @@ -168,7 +168,7 @@ libposix_a_SOURCES += src/sigpending.c \ src/sigwait.c src/sigwaitinfo.c src/signal_2.c src/ualarm.c ## SEMAPHORE_C_FILES -libposix_a_SOURCES += src/semaphore.c +libposix_a_SOURCES += src/psxsemaphore.c libposix_a_SOURCES += src/semaphoredeletesupp.c libposix_a_SOURCES += src/semclose.c libposix_a_SOURCES += src/semopen.c @@ -178,7 +178,7 @@ libposix_a_SOURCES += src/semunlink.c libposix_a_SOURCES += src/adjtime.c src/clockgetcpuclockid.c ## TIMER_C_FILES -libposix_a_SOURCES += src/ptimer.c src/timercreate.c src/timerdelete.c \ +libposix_a_SOURCES += src/ptimer.c src/psxtimercreate.c src/psxtimerdelete.c \ src/timergetoverrun.c src/timergettime.c src/timersettime.c ## ITIMER_C_FILES diff --git a/cpukit/posix/src/psxsemaphore.c b/cpukit/posix/src/psxsemaphore.c new file mode 100644 index 0000000000..a82ad17966 --- /dev/null +++ b/cpukit/posix/src/psxsemaphore.c @@ -0,0 +1,59 @@ +/** + * @file + * + * @brief POSIX Function Initializes Semaphore Manager + * @ingroup POSIXAPI + */ + +/* + * COPYRIGHT (c) 1989-2008. + * 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.org/license/LICENSE. + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include + +Objects_Information _POSIX_Semaphore_Information; + +/* + * _POSIX_Semaphore_Manager_initialization + * + * This routine initializes all semaphore manager related data structures. + * + * Input parameters: NONE + * + * Output parameters: NONE + */ + +static void _POSIX_Semaphore_Manager_initialization(void) +{ + _Objects_Initialize_information( + &_POSIX_Semaphore_Information, /* object information table */ + OBJECTS_POSIX_API, /* object API */ + OBJECTS_POSIX_SEMAPHORES, /* object class */ + Configuration_POSIX_API.maximum_semaphores, + /* maximum objects of this class */ + sizeof( POSIX_Semaphore_Control ), + /* size of this object's control block */ + true, /* true if names for this object are strings */ + _POSIX_PATH_MAX, /* maximum length of each object's name */ + NULL /* Proxy extraction support callout */ + ); +} + +RTEMS_SYSINIT_ITEM( + _POSIX_Semaphore_Manager_initialization, + RTEMS_SYSINIT_POSIX_SEMAPHORE, + RTEMS_SYSINIT_ORDER_MIDDLE +); diff --git a/cpukit/posix/src/psxtimercreate.c b/cpukit/posix/src/psxtimercreate.c new file mode 100644 index 0000000000..5123071d99 --- /dev/null +++ b/cpukit/posix/src/psxtimercreate.c @@ -0,0 +1,101 @@ +/** + * @file + * + * @brief Create a Per-Process Timer + * @ingroup POSIX_PRIV_TIMERS Timers + */ + +/* + * 14.2.2 Create a Per-Process Timer, P1003.1b-1993, p. 264 + * + * COPYRIGHT (c) 1989-2007. + * 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.org/license/LICENSE. + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +int timer_create( + clockid_t clock_id, + struct sigevent *__restrict evp, + timer_t *__restrict timerid +) +{ + POSIX_Timer_Control *ptimer; + + if ( clock_id != CLOCK_REALTIME ) + rtems_set_errno_and_return_minus_one( EINVAL ); + + if ( !timerid ) + rtems_set_errno_and_return_minus_one( EINVAL ); + + /* + * The data of the structure evp are checked in order to verify if they + * are coherent. + */ + + if (evp != NULL) { + /* The structure has data */ + if ( ( evp->sigev_notify != SIGEV_NONE ) && + ( evp->sigev_notify != SIGEV_SIGNAL ) ) { + /* The value of the field sigev_notify is not valid */ + rtems_set_errno_and_return_minus_one( EINVAL ); + } + + if ( !evp->sigev_signo ) + rtems_set_errno_and_return_minus_one( EINVAL ); + + if ( !is_valid_signo(evp->sigev_signo) ) + rtems_set_errno_and_return_minus_one( EINVAL ); + } + + /* + * Allocate a timer + */ + ptimer = _POSIX_Timer_Allocate(); + if ( !ptimer ) { + _Objects_Allocator_unlock(); + rtems_set_errno_and_return_minus_one( EAGAIN ); + } + + /* The data of the created timer are stored to use them later */ + + ptimer->state = POSIX_TIMER_STATE_CREATE_NEW; + ptimer->thread_id = _Thread_Get_executing()->Object.id; + + if ( evp != NULL ) { + ptimer->inf.sigev_notify = evp->sigev_notify; + ptimer->inf.sigev_signo = evp->sigev_signo; + ptimer->inf.sigev_value = evp->sigev_value; + } + + ptimer->overrun = 0; + ptimer->timer_data.it_value.tv_sec = 0; + ptimer->timer_data.it_value.tv_nsec = 0; + ptimer->timer_data.it_interval.tv_sec = 0; + ptimer->timer_data.it_interval.tv_nsec = 0; + + _Watchdog_Preinitialize( &ptimer->Timer, _Per_CPU_Get_snapshot() ); + _Watchdog_Initialize( &ptimer->Timer, _POSIX_Timer_TSR ); + _Objects_Open_u32(&_POSIX_Timer_Information, &ptimer->Object, 0); + + *timerid = ptimer->Object.id; + _Objects_Allocator_unlock(); + return 0; +} diff --git a/cpukit/posix/src/psxtimerdelete.c b/cpukit/posix/src/psxtimerdelete.c new file mode 100644 index 0000000000..7670838ac2 --- /dev/null +++ b/cpukit/posix/src/psxtimerdelete.c @@ -0,0 +1,71 @@ +/** + * @file + * + * @brief Deletes a POSIX Interval Timer + * @ingroup POSIXAPI + */ + +/* + * 14.2.3 Delete a Per_process Timer, P1003.1b-1993, p. 266 + * + * COPYRIGHT (c) 1989-2007. + * 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.org/license/LICENSE. + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include +#include +#include +#include +#include + + +int timer_delete( + timer_t timerid +) +{ + /* + * IDEA: This function must probably stop the timer first and then delete it + * + * It will have to do a call to rtems_timer_cancel and then another + * call to rtems_timer_delete. + * The call to rtems_timer_delete will be probably unnecessary, + * because rtems_timer_delete stops the timer before deleting it. + */ + POSIX_Timer_Control *ptimer; + ISR_lock_Context lock_context; + + _Objects_Allocator_lock(); + + ptimer = _POSIX_Timer_Get( timerid, &lock_context ); + if ( ptimer != NULL ) { + Per_CPU_Control *cpu; + + _Objects_Close( &_POSIX_Timer_Information, &ptimer->Object ); + cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context ); + ptimer->state = POSIX_TIMER_STATE_FREE; + _Watchdog_Remove( + &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_TICKS ], + &ptimer->Timer + ); + _POSIX_Timer_Release( cpu, &lock_context ); + _POSIX_Timer_Free( ptimer ); + _Objects_Allocator_unlock(); + return 0; + } + + _Objects_Allocator_unlock(); + + rtems_set_errno_and_return_minus_one( EINVAL ); +} diff --git a/cpukit/posix/src/semaphore.c b/cpukit/posix/src/semaphore.c deleted file mode 100644 index a82ad17966..0000000000 --- a/cpukit/posix/src/semaphore.c +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @file - * - * @brief POSIX Function Initializes Semaphore Manager - * @ingroup POSIXAPI - */ - -/* - * COPYRIGHT (c) 1989-2008. - * 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.org/license/LICENSE. - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include - -#include - -Objects_Information _POSIX_Semaphore_Information; - -/* - * _POSIX_Semaphore_Manager_initialization - * - * This routine initializes all semaphore manager related data structures. - * - * Input parameters: NONE - * - * Output parameters: NONE - */ - -static void _POSIX_Semaphore_Manager_initialization(void) -{ - _Objects_Initialize_information( - &_POSIX_Semaphore_Information, /* object information table */ - OBJECTS_POSIX_API, /* object API */ - OBJECTS_POSIX_SEMAPHORES, /* object class */ - Configuration_POSIX_API.maximum_semaphores, - /* maximum objects of this class */ - sizeof( POSIX_Semaphore_Control ), - /* size of this object's control block */ - true, /* true if names for this object are strings */ - _POSIX_PATH_MAX, /* maximum length of each object's name */ - NULL /* Proxy extraction support callout */ - ); -} - -RTEMS_SYSINIT_ITEM( - _POSIX_Semaphore_Manager_initialization, - RTEMS_SYSINIT_POSIX_SEMAPHORE, - RTEMS_SYSINIT_ORDER_MIDDLE -); diff --git a/cpukit/posix/src/timercreate.c b/cpukit/posix/src/timercreate.c deleted file mode 100644 index 5123071d99..0000000000 --- a/cpukit/posix/src/timercreate.c +++ /dev/null @@ -1,101 +0,0 @@ -/** - * @file - * - * @brief Create a Per-Process Timer - * @ingroup POSIX_PRIV_TIMERS Timers - */ - -/* - * 14.2.2 Create a Per-Process Timer, P1003.1b-1993, p. 264 - * - * COPYRIGHT (c) 1989-2007. - * 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.org/license/LICENSE. - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -int timer_create( - clockid_t clock_id, - struct sigevent *__restrict evp, - timer_t *__restrict timerid -) -{ - POSIX_Timer_Control *ptimer; - - if ( clock_id != CLOCK_REALTIME ) - rtems_set_errno_and_return_minus_one( EINVAL ); - - if ( !timerid ) - rtems_set_errno_and_return_minus_one( EINVAL ); - - /* - * The data of the structure evp are checked in order to verify if they - * are coherent. - */ - - if (evp != NULL) { - /* The structure has data */ - if ( ( evp->sigev_notify != SIGEV_NONE ) && - ( evp->sigev_notify != SIGEV_SIGNAL ) ) { - /* The value of the field sigev_notify is not valid */ - rtems_set_errno_and_return_minus_one( EINVAL ); - } - - if ( !evp->sigev_signo ) - rtems_set_errno_and_return_minus_one( EINVAL ); - - if ( !is_valid_signo(evp->sigev_signo) ) - rtems_set_errno_and_return_minus_one( EINVAL ); - } - - /* - * Allocate a timer - */ - ptimer = _POSIX_Timer_Allocate(); - if ( !ptimer ) { - _Objects_Allocator_unlock(); - rtems_set_errno_and_return_minus_one( EAGAIN ); - } - - /* The data of the created timer are stored to use them later */ - - ptimer->state = POSIX_TIMER_STATE_CREATE_NEW; - ptimer->thread_id = _Thread_Get_executing()->Object.id; - - if ( evp != NULL ) { - ptimer->inf.sigev_notify = evp->sigev_notify; - ptimer->inf.sigev_signo = evp->sigev_signo; - ptimer->inf.sigev_value = evp->sigev_value; - } - - ptimer->overrun = 0; - ptimer->timer_data.it_value.tv_sec = 0; - ptimer->timer_data.it_value.tv_nsec = 0; - ptimer->timer_data.it_interval.tv_sec = 0; - ptimer->timer_data.it_interval.tv_nsec = 0; - - _Watchdog_Preinitialize( &ptimer->Timer, _Per_CPU_Get_snapshot() ); - _Watchdog_Initialize( &ptimer->Timer, _POSIX_Timer_TSR ); - _Objects_Open_u32(&_POSIX_Timer_Information, &ptimer->Object, 0); - - *timerid = ptimer->Object.id; - _Objects_Allocator_unlock(); - return 0; -} diff --git a/cpukit/posix/src/timerdelete.c b/cpukit/posix/src/timerdelete.c deleted file mode 100644 index 7670838ac2..0000000000 --- a/cpukit/posix/src/timerdelete.c +++ /dev/null @@ -1,71 +0,0 @@ -/** - * @file - * - * @brief Deletes a POSIX Interval Timer - * @ingroup POSIXAPI - */ - -/* - * 14.2.3 Delete a Per_process Timer, P1003.1b-1993, p. 266 - * - * COPYRIGHT (c) 1989-2007. - * 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.org/license/LICENSE. - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include - -#include -#include -#include -#include -#include - - -int timer_delete( - timer_t timerid -) -{ - /* - * IDEA: This function must probably stop the timer first and then delete it - * - * It will have to do a call to rtems_timer_cancel and then another - * call to rtems_timer_delete. - * The call to rtems_timer_delete will be probably unnecessary, - * because rtems_timer_delete stops the timer before deleting it. - */ - POSIX_Timer_Control *ptimer; - ISR_lock_Context lock_context; - - _Objects_Allocator_lock(); - - ptimer = _POSIX_Timer_Get( timerid, &lock_context ); - if ( ptimer != NULL ) { - Per_CPU_Control *cpu; - - _Objects_Close( &_POSIX_Timer_Information, &ptimer->Object ); - cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context ); - ptimer->state = POSIX_TIMER_STATE_FREE; - _Watchdog_Remove( - &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_TICKS ], - &ptimer->Timer - ); - _POSIX_Timer_Release( cpu, &lock_context ); - _POSIX_Timer_Free( ptimer ); - _Objects_Allocator_unlock(); - return 0; - } - - _Objects_Allocator_unlock(); - - rtems_set_errno_and_return_minus_one( EINVAL ); -} -- cgit v1.2.3