Split time.c into multiple files.

This commit is contained in:
Joel Sherrill
1999-11-02 18:35:52 +00:00
parent 98dca75bf3
commit 9f95a19a57
27 changed files with 1151 additions and 731 deletions

View File

@@ -62,11 +62,15 @@ SEMAPHORE_C_PIECES= semaphore semaphorecreatesupp semaphoredeletesupp \
semgetvalue seminit semopen sempost semtimedwait semtrywait \
semunlink semwait
TIME_C_PIECES= time posixtimespecsubtract posixtimespectointerval \
posixintervaltotimespec clockgetcpuclockid clockgetenableattr \
clockgetres clockgettime clocksetenableattr clocksettime nanosleep
C_PIECES = adasupp $(CONDITION_VARIABLE_C_PIECES) \
getpid key $(MESSAGE_QUEUE_C_PIECES) \
$(MUTEX_C_PIECES) $(PTHREAD_C_PIECES) \
$(PSIGNAL_C_PIECES) ptimer sched $(SEMAPHORE_C_PIECES) \
time types unistd $(ENOSYS_C_PIECES) \
$(TIME_C_PIECES) types unistd $(ENOSYS_C_PIECES) \
$(BUILD_FOR_NOW_C_PIECES)
C_FILES = $(C_PIECES:%=%.c)

View File

@@ -0,0 +1,28 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* 20.1.3 Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55
*/
int clock_getcpuclockid(
pid_t pid,
clockid_t *clock_id
)
{
return POSIX_NOT_IMPLEMENTED();
}

View File

@@ -0,0 +1,28 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* 20.1.5 CPU-time Clock Attribute Access, P1003.4b/D8, p. 58
*/
int clock_getenable_attr(
clockid_t clock_id,
int *attr
)
{
return POSIX_NOT_IMPLEMENTED();
}

View File

@@ -0,0 +1,48 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* 14.2.1 Clocks, P1003.1b-1993, p. 263
*/
int clock_getres(
clockid_t clock_id,
struct timespec *res
)
{
if ( !res )
set_errno_and_return_minus_one( EINVAL );
switch ( clock_id ) {
/*
* All time in rtems is based on the same clock tick.
*/
case CLOCK_REALTIME:
case CLOCK_PROCESS_CPUTIME:
case CLOCK_THREAD_CPUTIME:
if ( res )
_POSIX_Interval_to_timespec( _TOD_Microseconds_per_tick, res );
break;
default:
set_errno_and_return_minus_one( EINVAL );
}
return 0;
}

View File

@@ -0,0 +1,65 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* 14.2.1 Clocks, P1003.1b-1993, p. 263
*/
int clock_gettime(
clockid_t clock_id,
struct timespec *tp
)
{
ISR_Level level;
time_t seconds;
long ticks;
if ( !tp )
set_errno_and_return_minus_one( EINVAL );
switch ( clock_id ) {
case CLOCK_REALTIME:
_ISR_Disable( level );
seconds = _TOD_Seconds_since_epoch;
ticks = _TOD_Current.ticks;
_ISR_Enable( level );
tp->tv_sec = seconds + POSIX_TIME_SECONDS_1970_THROUGH_1988;
tp->tv_nsec = ticks * _TOD_Microseconds_per_tick *
TOD_NANOSECONDS_PER_MICROSECOND;
break;
#ifdef _POSIX_CPUTIME
case CLOCK_PROCESS_CPUTIME:
/* don't base this on _Watchdog_Ticks_since_boot--duration is too short*/
return POSIX_NOT_IMPLEMENTED();
break;
#endif
#ifdef _POSIX_THREAD_CPUTIME
case CLOCK_THREAD_CPUTIME:
return POSIX_NOT_IMPLEMENTED();
break;
#endif
default:
set_errno_and_return_minus_one( EINVAL );
}
return 0;
}

View File

@@ -0,0 +1,28 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* 20.1.5 CPU-time Clock Attribute Access, P1003.4b/D8, p. 58
*/
int clock_setenable_attr(
clockid_t clock_id,
int attr
)
{
return POSIX_NOT_IMPLEMENTED();
}

View File

@@ -0,0 +1,84 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* 14.2.1 Clocks, P1003.1b-1993, p. 263
*/
int clock_settime(
clockid_t clock_id,
const struct timespec *tp
)
{
struct tm split_time;
TOD_Control tod;
Watchdog_Interval seconds;
assert( tp );
switch ( clock_id ) {
case CLOCK_REALTIME:
(void) gmtime_r( &tp->tv_sec, &split_time );
/*
* Convert the tm structure format to that used by the TOD Handler
*
* NOTE: TOD Handler does not honor leap seconds.
*/
tod.year = split_time.tm_year + 1900; /* RHS is years since 1900 */
tod.month = split_time.tm_mon + 1; /* RHS uses 0-11 */
tod.day = split_time.tm_mday;
tod.hour = split_time.tm_hour;
tod.minute = split_time.tm_min;
tod.second = split_time.tm_sec; /* RHS allows 0-61 for leap seconds */
tod.ticks = (tp->tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND) /
_TOD_Microseconds_per_tick;
if ( !_TOD_Validate( &tod ) )
set_errno_and_return_minus_one( EINVAL );
/*
* We can't use the tp->tv_sec field because it is based on
* a different EPOCH.
*/
seconds = _TOD_To_seconds( &tod );
_Thread_Disable_dispatch();
_TOD_Set( &tod, seconds );
_Thread_Enable_dispatch();
break;
#ifdef _POSIX_CPUTIME
case CLOCK_PROCESS_CPUTIME:
return POSIX_NOT_IMPLEMENTED();
break;
#endif
#ifdef _POSIX_THREAD_CPUTIME
case CLOCK_THREAD_CPUTIME:
return POSIX_NOT_IMPLEMENTED();
break;
#endif
default:
set_errno_and_return_minus_one( EINVAL );
}
return 0;
}

View File

@@ -18,17 +18,34 @@
/*PAGE
*
* 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
* 13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
*/
int pthread_mutexattr_getprioceiling(
const pthread_mutexattr_t *attr,
int *prioceiling
int pthread_mutex_getprioceiling(
pthread_mutex_t *mutex,
int *prioceiling
)
{
if ( !attr || !attr->is_initialized || !prioceiling )
register POSIX_Mutex_Control *the_mutex;
Objects_Locations location;
if ( !prioceiling )
return EINVAL;
*prioceiling = attr->prio_ceiling;
return 0;
the_mutex = _POSIX_Mutex_Get( mutex, &location );
switch ( location ) {
case OBJECTS_REMOTE:
#if defined(RTEMS_MULTIPROCESSING)
return POSIX_MP_NOT_IMPLEMENTED(); /* XXX feels questionable */
#endif
case OBJECTS_ERROR:
return EINVAL;
case OBJECTS_LOCAL:
*prioceiling = _POSIX_Priority_From_core(
the_mutex->Mutex.Attributes.priority_ceiling
);
_Thread_Enable_dispatch();
return 0;
}
return POSIX_BOTTOM_REACHED();
}

View File

@@ -18,20 +18,61 @@
/*PAGE
*
* 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
* 13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
*/
int pthread_mutexattr_setprioceiling(
pthread_mutexattr_t *attr,
int prioceiling
int pthread_mutex_setprioceiling(
pthread_mutex_t *mutex,
int prioceiling,
int *old_ceiling
)
{
if ( !attr || !attr->is_initialized )
register POSIX_Mutex_Control *the_mutex;
Objects_Locations location;
Priority_Control the_priority;
int status;
if ( !old_ceiling )
return EINVAL;
if ( !_POSIX_Priority_Is_valid( prioceiling ) )
return EINVAL;
attr->prio_ceiling = prioceiling;
return 0;
the_priority = _POSIX_Priority_To_core( prioceiling );
/*
* Must acquire the mutex before we can change it's ceiling
*/
status = pthread_mutex_lock( mutex );
if ( status )
return status;
the_mutex = _POSIX_Mutex_Get( mutex, &location );
switch ( location ) {
case OBJECTS_REMOTE:
#if defined(RTEMS_MULTIPROCESSING)
/* XXX It feels questionable to set the ceiling on a remote mutex. */
return EINVAL;
#endif
case OBJECTS_ERROR:
return EINVAL; /* impossible to get here */
case OBJECTS_LOCAL:
*old_ceiling = _POSIX_Priority_From_core(
the_mutex->Mutex.Attributes.priority_ceiling
);
the_mutex->Mutex.Attributes.priority_ceiling = the_priority;
_CORE_mutex_Surrender(
&the_mutex->Mutex,
the_mutex->Object.id,
#if defined(RTEMS_MULTIPROCESSING)
POSIX_Threads_mutex_MP_support
#else
NULL
#endif
);
_Thread_Enable_dispatch();
return 0;
}
return POSIX_BOTTOM_REACHED();
}

View File

@@ -0,0 +1,100 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* 14.2.5 High Resolution Sleep, P1003.1b-1993, p. 269
*/
int nanosleep(
const struct timespec *rqtp,
struct timespec *rmtp
)
{
Watchdog_Interval ticks;
struct timespec *the_rqtp;
if ( !rqtp )
set_errno_and_return_minus_one( EINVAL );
the_rqtp = (struct timespec *)rqtp;
/*
* Return EAGAIN if the delay interval is negative.
*
* NOTE: This behavior is beyond the POSIX specification.
* FSU pthreads shares this behavior.
*/
if ( the_rqtp->tv_sec < 0 )
the_rqtp->tv_sec = 0;
if ( /* the_rqtp->tv_sec < 0 || */ the_rqtp->tv_nsec < 0 )
set_errno_and_return_minus_one( EAGAIN );
if ( the_rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND )
set_errno_and_return_minus_one( EINVAL );
ticks = _POSIX_Timespec_to_interval( the_rqtp );
/*
* This behavior is also beyond the POSIX specification but is
* consistent with the RTEMS api and yields desirable behavior.
*/
if ( !ticks ) {
_Thread_Disable_dispatch();
_Thread_Yield_processor();
_Thread_Enable_dispatch();
if ( rmtp ) {
rmtp->tv_sec = 0;
rmtp->tv_nsec = 0;
}
return 0;
}
_Thread_Disable_dispatch();
_Thread_Set_state(
_Thread_Executing,
STATES_DELAYING | STATES_INTERRUPTIBLE_BY_SIGNAL
);
_Watchdog_Initialize(
&_Thread_Executing->Timer,
_Thread_Delay_ended,
_Thread_Executing->Object.id,
NULL
);
_Watchdog_Insert_ticks( &_Thread_Executing->Timer, ticks );
_Thread_Enable_dispatch();
/* calculate time remaining */
if ( rmtp ) {
ticks -=
_Thread_Executing->Timer.stop_time - _Thread_Executing->Timer.start_time;
_POSIX_Interval_to_timespec( ticks, rmtp );
/*
* If there is time remaining, then we were interrupted by a signal.
*/
if ( ticks )
set_errno_and_return_minus_one( EINTR );
}
return 0;
}

View File

@@ -0,0 +1,34 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* _POSIX_Interval_to_timespec
*/
void _POSIX_Interval_to_timespec(
Watchdog_Interval ticks,
struct timespec *time
)
{
unsigned32 usecs;
usecs = ticks * _TOD_Microseconds_per_tick;
time->tv_sec = usecs / TOD_MICROSECONDS_PER_SECOND;
time->tv_nsec = (usecs % TOD_MICROSECONDS_PER_SECOND) *
TOD_NANOSECONDS_PER_MICROSECOND;
}

View File

@@ -0,0 +1,46 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* _POSIX_Timespec_subtract
*/
void _POSIX_Timespec_subtract(
const struct timespec *the_start,
const struct timespec *end,
struct timespec *result
)
{
struct timespec start_struct = *the_start;
struct timespec *start = &start_struct;
unsigned int nsecs_per_sec = TOD_NANOSECONDS_PER_SECOND;
if (end->tv_nsec < start->tv_nsec) {
int seconds = (start->tv_nsec - end->tv_nsec) / nsecs_per_sec + 1;
start->tv_nsec -= nsecs_per_sec * seconds;
start->tv_sec += seconds;
}
if (end->tv_nsec - start->tv_nsec > nsecs_per_sec) {
int seconds = (start->tv_nsec - end->tv_nsec) / nsecs_per_sec;
start->tv_nsec += nsecs_per_sec * seconds;
start->tv_sec -= seconds;
}
result->tv_sec = end->tv_sec - start->tv_sec;
result->tv_nsec = end->tv_nsec - start->tv_nsec;
}

View File

@@ -0,0 +1,38 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* _POSIX_Timespec_to_interval
*/
Watchdog_Interval _POSIX_Timespec_to_interval(
const struct timespec *time
)
{
Watchdog_Interval ticks;
ticks = (time->tv_sec * TOD_MICROSECONDS_PER_SECOND) /
_TOD_Microseconds_per_tick;
ticks += (time->tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND) /
_TOD_Microseconds_per_tick;
if (ticks)
return ticks;
return 1;
}

View File

@@ -14,79 +14,6 @@
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* _POSIX_Timespec_subtract
*/
void _POSIX_Timespec_subtract(
const struct timespec *the_start,
const struct timespec *end,
struct timespec *result
)
{
struct timespec start_struct = *the_start;
struct timespec *start = &start_struct;
unsigned int nsecs_per_sec = TOD_NANOSECONDS_PER_SECOND;
if (end->tv_nsec < start->tv_nsec) {
int seconds = (start->tv_nsec - end->tv_nsec) / nsecs_per_sec + 1;
start->tv_nsec -= nsecs_per_sec * seconds;
start->tv_sec += seconds;
}
if (end->tv_nsec - start->tv_nsec > nsecs_per_sec) {
int seconds = (start->tv_nsec - end->tv_nsec) / nsecs_per_sec;
start->tv_nsec += nsecs_per_sec * seconds;
start->tv_sec -= seconds;
}
result->tv_sec = end->tv_sec - start->tv_sec;
result->tv_nsec = end->tv_nsec - start->tv_nsec;
}
/*PAGE
*
* _POSIX_Timespec_to_interval
*/
Watchdog_Interval _POSIX_Timespec_to_interval(
const struct timespec *time
)
{
Watchdog_Interval ticks;
ticks = (time->tv_sec * TOD_MICROSECONDS_PER_SECOND) /
_TOD_Microseconds_per_tick;
ticks += (time->tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND) /
_TOD_Microseconds_per_tick;
if (ticks)
return ticks;
return 1;
}
/*PAGE
*
* _POSIX_Interval_to_timespec
*/
void _POSIX_Interval_to_timespec(
Watchdog_Interval ticks,
struct timespec *time
)
{
unsigned32 usecs;
usecs = ticks * _TOD_Microseconds_per_tick;
time->tv_sec = usecs / TOD_MICROSECONDS_PER_SECOND;
time->tv_nsec = (usecs % TOD_MICROSECONDS_PER_SECOND) *
TOD_NANOSECONDS_PER_MICROSECOND;
}
/*PAGE
*
* 4.5.1 Get System Time, P1003.1b-1993, p. 91
@@ -119,279 +46,3 @@ time_t time(
return seconds_since_epoch;
}
#endif
/*PAGE
*
* 14.2.1 Clocks, P1003.1b-1993, p. 263
*/
int clock_settime(
clockid_t clock_id,
const struct timespec *tp
)
{
struct tm split_time;
TOD_Control tod;
Watchdog_Interval seconds;
assert( tp );
switch ( clock_id ) {
case CLOCK_REALTIME:
(void) gmtime_r( &tp->tv_sec, &split_time );
/*
* Convert the tm structure format to that used by the TOD Handler
*
* NOTE: TOD Handler does not honor leap seconds.
*/
tod.year = split_time.tm_year + 1900; /* RHS is years since 1900 */
tod.month = split_time.tm_mon + 1; /* RHS uses 0-11 */
tod.day = split_time.tm_mday;
tod.hour = split_time.tm_hour;
tod.minute = split_time.tm_min;
tod.second = split_time.tm_sec; /* RHS allows 0-61 for leap seconds */
tod.ticks = (tp->tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND) /
_TOD_Microseconds_per_tick;
if ( !_TOD_Validate( &tod ) )
set_errno_and_return_minus_one( EINVAL );
/*
* We can't use the tp->tv_sec field because it is based on
* a different EPOCH.
*/
seconds = _TOD_To_seconds( &tod );
_Thread_Disable_dispatch();
_TOD_Set( &tod, seconds );
_Thread_Enable_dispatch();
break;
#ifdef _POSIX_CPUTIME
case CLOCK_PROCESS_CPUTIME:
return POSIX_NOT_IMPLEMENTED();
break;
#endif
#ifdef _POSIX_THREAD_CPUTIME
case CLOCK_THREAD_CPUTIME:
return POSIX_NOT_IMPLEMENTED();
break;
#endif
default:
set_errno_and_return_minus_one( EINVAL );
}
return 0;
}
/*PAGE
*
* 14.2.1 Clocks, P1003.1b-1993, p. 263
*/
int clock_gettime(
clockid_t clock_id,
struct timespec *tp
)
{
ISR_Level level;
time_t seconds;
long ticks;
if ( !tp )
set_errno_and_return_minus_one( EINVAL );
switch ( clock_id ) {
case CLOCK_REALTIME:
_ISR_Disable( level );
seconds = _TOD_Seconds_since_epoch;
ticks = _TOD_Current.ticks;
_ISR_Enable( level );
tp->tv_sec = seconds + POSIX_TIME_SECONDS_1970_THROUGH_1988;
tp->tv_nsec = ticks * _TOD_Microseconds_per_tick *
TOD_NANOSECONDS_PER_MICROSECOND;
break;
#ifdef _POSIX_CPUTIME
case CLOCK_PROCESS_CPUTIME:
/* don't base this on _Watchdog_Ticks_since_boot--duration is too short*/
return POSIX_NOT_IMPLEMENTED();
break;
#endif
#ifdef _POSIX_THREAD_CPUTIME
case CLOCK_THREAD_CPUTIME:
return POSIX_NOT_IMPLEMENTED();
break;
#endif
default:
set_errno_and_return_minus_one( EINVAL );
}
return 0;
}
/*PAGE
*
* 14.2.1 Clocks, P1003.1b-1993, p. 263
*/
int clock_getres(
clockid_t clock_id,
struct timespec *res
)
{
if ( !res )
set_errno_and_return_minus_one( EINVAL );
switch ( clock_id ) {
/*
* All time in rtems is based on the same clock tick.
*/
case CLOCK_REALTIME:
case CLOCK_PROCESS_CPUTIME:
case CLOCK_THREAD_CPUTIME:
if ( res )
_POSIX_Interval_to_timespec( _TOD_Microseconds_per_tick, res );
break;
default:
set_errno_and_return_minus_one( EINVAL );
}
return 0;
}
/*PAGE
*
* 14.2.5 High Resolution Sleep, P1003.1b-1993, p. 269
*/
int nanosleep(
const struct timespec *rqtp,
struct timespec *rmtp
)
{
Watchdog_Interval ticks;
struct timespec *the_rqtp;
if ( !rqtp )
set_errno_and_return_minus_one( EINVAL );
the_rqtp = (struct timespec *)rqtp;
/*
* Return EAGAIN if the delay interval is negative.
*
* NOTE: This behavior is beyond the POSIX specification.
* FSU pthreads shares this behavior.
*/
if ( the_rqtp->tv_sec < 0 )
the_rqtp->tv_sec = 0;
if ( /* the_rqtp->tv_sec < 0 || */ the_rqtp->tv_nsec < 0 )
set_errno_and_return_minus_one( EAGAIN );
if ( the_rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND )
set_errno_and_return_minus_one( EINVAL );
ticks = _POSIX_Timespec_to_interval( the_rqtp );
/*
* This behavior is also beyond the POSIX specification but is
* consistent with the RTEMS api and yields desirable behavior.
*/
if ( !ticks ) {
_Thread_Disable_dispatch();
_Thread_Yield_processor();
_Thread_Enable_dispatch();
if ( rmtp ) {
rmtp->tv_sec = 0;
rmtp->tv_nsec = 0;
}
return 0;
}
_Thread_Disable_dispatch();
_Thread_Set_state(
_Thread_Executing,
STATES_DELAYING | STATES_INTERRUPTIBLE_BY_SIGNAL
);
_Watchdog_Initialize(
&_Thread_Executing->Timer,
_Thread_Delay_ended,
_Thread_Executing->Object.id,
NULL
);
_Watchdog_Insert_ticks( &_Thread_Executing->Timer, ticks );
_Thread_Enable_dispatch();
/* calculate time remaining */
if ( rmtp ) {
ticks -=
_Thread_Executing->Timer.stop_time - _Thread_Executing->Timer.start_time;
_POSIX_Interval_to_timespec( ticks, rmtp );
/*
* If there is time remaining, then we were interrupted by a signal.
*/
if ( ticks )
set_errno_and_return_minus_one( EINTR );
}
return 0;
}
/*PAGE
*
* 20.1.3 Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55
*/
int clock_getcpuclockid(
pid_t pid,
clockid_t *clock_id
)
{
return POSIX_NOT_IMPLEMENTED();
}
/*PAGE
*
* 20.1.5 CPU-time Clock Attribute Access, P1003.4b/D8, p. 58
*/
int clock_setenable_attr(
clockid_t clock_id,
int attr
)
{
return POSIX_NOT_IMPLEMENTED();
}
/*PAGE
*
* 20.1.5 CPU-time Clock Attribute Access, P1003.4b/D8, p. 58
*/
int clock_getenable_attr(
clockid_t clock_id,
int *attr
)
{
return POSIX_NOT_IMPLEMENTED();
}

View File

@@ -0,0 +1,28 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* 20.1.3 Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55
*/
int clock_getcpuclockid(
pid_t pid,
clockid_t *clock_id
)
{
return POSIX_NOT_IMPLEMENTED();
}

View File

@@ -0,0 +1,28 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* 20.1.5 CPU-time Clock Attribute Access, P1003.4b/D8, p. 58
*/
int clock_getenable_attr(
clockid_t clock_id,
int *attr
)
{
return POSIX_NOT_IMPLEMENTED();
}

View File

@@ -0,0 +1,48 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* 14.2.1 Clocks, P1003.1b-1993, p. 263
*/
int clock_getres(
clockid_t clock_id,
struct timespec *res
)
{
if ( !res )
set_errno_and_return_minus_one( EINVAL );
switch ( clock_id ) {
/*
* All time in rtems is based on the same clock tick.
*/
case CLOCK_REALTIME:
case CLOCK_PROCESS_CPUTIME:
case CLOCK_THREAD_CPUTIME:
if ( res )
_POSIX_Interval_to_timespec( _TOD_Microseconds_per_tick, res );
break;
default:
set_errno_and_return_minus_one( EINVAL );
}
return 0;
}

View File

@@ -0,0 +1,65 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* 14.2.1 Clocks, P1003.1b-1993, p. 263
*/
int clock_gettime(
clockid_t clock_id,
struct timespec *tp
)
{
ISR_Level level;
time_t seconds;
long ticks;
if ( !tp )
set_errno_and_return_minus_one( EINVAL );
switch ( clock_id ) {
case CLOCK_REALTIME:
_ISR_Disable( level );
seconds = _TOD_Seconds_since_epoch;
ticks = _TOD_Current.ticks;
_ISR_Enable( level );
tp->tv_sec = seconds + POSIX_TIME_SECONDS_1970_THROUGH_1988;
tp->tv_nsec = ticks * _TOD_Microseconds_per_tick *
TOD_NANOSECONDS_PER_MICROSECOND;
break;
#ifdef _POSIX_CPUTIME
case CLOCK_PROCESS_CPUTIME:
/* don't base this on _Watchdog_Ticks_since_boot--duration is too short*/
return POSIX_NOT_IMPLEMENTED();
break;
#endif
#ifdef _POSIX_THREAD_CPUTIME
case CLOCK_THREAD_CPUTIME:
return POSIX_NOT_IMPLEMENTED();
break;
#endif
default:
set_errno_and_return_minus_one( EINVAL );
}
return 0;
}

View File

@@ -0,0 +1,28 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* 20.1.5 CPU-time Clock Attribute Access, P1003.4b/D8, p. 58
*/
int clock_setenable_attr(
clockid_t clock_id,
int attr
)
{
return POSIX_NOT_IMPLEMENTED();
}

View File

@@ -0,0 +1,84 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* 14.2.1 Clocks, P1003.1b-1993, p. 263
*/
int clock_settime(
clockid_t clock_id,
const struct timespec *tp
)
{
struct tm split_time;
TOD_Control tod;
Watchdog_Interval seconds;
assert( tp );
switch ( clock_id ) {
case CLOCK_REALTIME:
(void) gmtime_r( &tp->tv_sec, &split_time );
/*
* Convert the tm structure format to that used by the TOD Handler
*
* NOTE: TOD Handler does not honor leap seconds.
*/
tod.year = split_time.tm_year + 1900; /* RHS is years since 1900 */
tod.month = split_time.tm_mon + 1; /* RHS uses 0-11 */
tod.day = split_time.tm_mday;
tod.hour = split_time.tm_hour;
tod.minute = split_time.tm_min;
tod.second = split_time.tm_sec; /* RHS allows 0-61 for leap seconds */
tod.ticks = (tp->tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND) /
_TOD_Microseconds_per_tick;
if ( !_TOD_Validate( &tod ) )
set_errno_and_return_minus_one( EINVAL );
/*
* We can't use the tp->tv_sec field because it is based on
* a different EPOCH.
*/
seconds = _TOD_To_seconds( &tod );
_Thread_Disable_dispatch();
_TOD_Set( &tod, seconds );
_Thread_Enable_dispatch();
break;
#ifdef _POSIX_CPUTIME
case CLOCK_PROCESS_CPUTIME:
return POSIX_NOT_IMPLEMENTED();
break;
#endif
#ifdef _POSIX_THREAD_CPUTIME
case CLOCK_THREAD_CPUTIME:
return POSIX_NOT_IMPLEMENTED();
break;
#endif
default:
set_errno_and_return_minus_one( EINVAL );
}
return 0;
}

View File

@@ -18,17 +18,34 @@
/*PAGE
*
* 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
* 13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
*/
int pthread_mutexattr_getprioceiling(
const pthread_mutexattr_t *attr,
int *prioceiling
int pthread_mutex_getprioceiling(
pthread_mutex_t *mutex,
int *prioceiling
)
{
if ( !attr || !attr->is_initialized || !prioceiling )
register POSIX_Mutex_Control *the_mutex;
Objects_Locations location;
if ( !prioceiling )
return EINVAL;
*prioceiling = attr->prio_ceiling;
return 0;
the_mutex = _POSIX_Mutex_Get( mutex, &location );
switch ( location ) {
case OBJECTS_REMOTE:
#if defined(RTEMS_MULTIPROCESSING)
return POSIX_MP_NOT_IMPLEMENTED(); /* XXX feels questionable */
#endif
case OBJECTS_ERROR:
return EINVAL;
case OBJECTS_LOCAL:
*prioceiling = _POSIX_Priority_From_core(
the_mutex->Mutex.Attributes.priority_ceiling
);
_Thread_Enable_dispatch();
return 0;
}
return POSIX_BOTTOM_REACHED();
}

View File

@@ -18,20 +18,61 @@
/*PAGE
*
* 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
* 13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
*/
int pthread_mutexattr_setprioceiling(
pthread_mutexattr_t *attr,
int prioceiling
int pthread_mutex_setprioceiling(
pthread_mutex_t *mutex,
int prioceiling,
int *old_ceiling
)
{
if ( !attr || !attr->is_initialized )
register POSIX_Mutex_Control *the_mutex;
Objects_Locations location;
Priority_Control the_priority;
int status;
if ( !old_ceiling )
return EINVAL;
if ( !_POSIX_Priority_Is_valid( prioceiling ) )
return EINVAL;
attr->prio_ceiling = prioceiling;
return 0;
the_priority = _POSIX_Priority_To_core( prioceiling );
/*
* Must acquire the mutex before we can change it's ceiling
*/
status = pthread_mutex_lock( mutex );
if ( status )
return status;
the_mutex = _POSIX_Mutex_Get( mutex, &location );
switch ( location ) {
case OBJECTS_REMOTE:
#if defined(RTEMS_MULTIPROCESSING)
/* XXX It feels questionable to set the ceiling on a remote mutex. */
return EINVAL;
#endif
case OBJECTS_ERROR:
return EINVAL; /* impossible to get here */
case OBJECTS_LOCAL:
*old_ceiling = _POSIX_Priority_From_core(
the_mutex->Mutex.Attributes.priority_ceiling
);
the_mutex->Mutex.Attributes.priority_ceiling = the_priority;
_CORE_mutex_Surrender(
&the_mutex->Mutex,
the_mutex->Object.id,
#if defined(RTEMS_MULTIPROCESSING)
POSIX_Threads_mutex_MP_support
#else
NULL
#endif
);
_Thread_Enable_dispatch();
return 0;
}
return POSIX_BOTTOM_REACHED();
}

View File

@@ -0,0 +1,100 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* 14.2.5 High Resolution Sleep, P1003.1b-1993, p. 269
*/
int nanosleep(
const struct timespec *rqtp,
struct timespec *rmtp
)
{
Watchdog_Interval ticks;
struct timespec *the_rqtp;
if ( !rqtp )
set_errno_and_return_minus_one( EINVAL );
the_rqtp = (struct timespec *)rqtp;
/*
* Return EAGAIN if the delay interval is negative.
*
* NOTE: This behavior is beyond the POSIX specification.
* FSU pthreads shares this behavior.
*/
if ( the_rqtp->tv_sec < 0 )
the_rqtp->tv_sec = 0;
if ( /* the_rqtp->tv_sec < 0 || */ the_rqtp->tv_nsec < 0 )
set_errno_and_return_minus_one( EAGAIN );
if ( the_rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND )
set_errno_and_return_minus_one( EINVAL );
ticks = _POSIX_Timespec_to_interval( the_rqtp );
/*
* This behavior is also beyond the POSIX specification but is
* consistent with the RTEMS api and yields desirable behavior.
*/
if ( !ticks ) {
_Thread_Disable_dispatch();
_Thread_Yield_processor();
_Thread_Enable_dispatch();
if ( rmtp ) {
rmtp->tv_sec = 0;
rmtp->tv_nsec = 0;
}
return 0;
}
_Thread_Disable_dispatch();
_Thread_Set_state(
_Thread_Executing,
STATES_DELAYING | STATES_INTERRUPTIBLE_BY_SIGNAL
);
_Watchdog_Initialize(
&_Thread_Executing->Timer,
_Thread_Delay_ended,
_Thread_Executing->Object.id,
NULL
);
_Watchdog_Insert_ticks( &_Thread_Executing->Timer, ticks );
_Thread_Enable_dispatch();
/* calculate time remaining */
if ( rmtp ) {
ticks -=
_Thread_Executing->Timer.stop_time - _Thread_Executing->Timer.start_time;
_POSIX_Interval_to_timespec( ticks, rmtp );
/*
* If there is time remaining, then we were interrupted by a signal.
*/
if ( ticks )
set_errno_and_return_minus_one( EINTR );
}
return 0;
}

View File

@@ -0,0 +1,34 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* _POSIX_Interval_to_timespec
*/
void _POSIX_Interval_to_timespec(
Watchdog_Interval ticks,
struct timespec *time
)
{
unsigned32 usecs;
usecs = ticks * _TOD_Microseconds_per_tick;
time->tv_sec = usecs / TOD_MICROSECONDS_PER_SECOND;
time->tv_nsec = (usecs % TOD_MICROSECONDS_PER_SECOND) *
TOD_NANOSECONDS_PER_MICROSECOND;
}

View File

@@ -0,0 +1,46 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* _POSIX_Timespec_subtract
*/
void _POSIX_Timespec_subtract(
const struct timespec *the_start,
const struct timespec *end,
struct timespec *result
)
{
struct timespec start_struct = *the_start;
struct timespec *start = &start_struct;
unsigned int nsecs_per_sec = TOD_NANOSECONDS_PER_SECOND;
if (end->tv_nsec < start->tv_nsec) {
int seconds = (start->tv_nsec - end->tv_nsec) / nsecs_per_sec + 1;
start->tv_nsec -= nsecs_per_sec * seconds;
start->tv_sec += seconds;
}
if (end->tv_nsec - start->tv_nsec > nsecs_per_sec) {
int seconds = (start->tv_nsec - end->tv_nsec) / nsecs_per_sec;
start->tv_nsec += nsecs_per_sec * seconds;
start->tv_sec -= seconds;
}
result->tv_sec = end->tv_sec - start->tv_sec;
result->tv_nsec = end->tv_nsec - start->tv_nsec;
}

View File

@@ -0,0 +1,38 @@
/*
* $Id$
*/
#include <assert.h>
#include <time.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* _POSIX_Timespec_to_interval
*/
Watchdog_Interval _POSIX_Timespec_to_interval(
const struct timespec *time
)
{
Watchdog_Interval ticks;
ticks = (time->tv_sec * TOD_MICROSECONDS_PER_SECOND) /
_TOD_Microseconds_per_tick;
ticks += (time->tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND) /
_TOD_Microseconds_per_tick;
if (ticks)
return ticks;
return 1;
}

View File

@@ -14,79 +14,6 @@
#include <rtems/posix/seterr.h>
#include <rtems/posix/time.h>
/*PAGE
*
* _POSIX_Timespec_subtract
*/
void _POSIX_Timespec_subtract(
const struct timespec *the_start,
const struct timespec *end,
struct timespec *result
)
{
struct timespec start_struct = *the_start;
struct timespec *start = &start_struct;
unsigned int nsecs_per_sec = TOD_NANOSECONDS_PER_SECOND;
if (end->tv_nsec < start->tv_nsec) {
int seconds = (start->tv_nsec - end->tv_nsec) / nsecs_per_sec + 1;
start->tv_nsec -= nsecs_per_sec * seconds;
start->tv_sec += seconds;
}
if (end->tv_nsec - start->tv_nsec > nsecs_per_sec) {
int seconds = (start->tv_nsec - end->tv_nsec) / nsecs_per_sec;
start->tv_nsec += nsecs_per_sec * seconds;
start->tv_sec -= seconds;
}
result->tv_sec = end->tv_sec - start->tv_sec;
result->tv_nsec = end->tv_nsec - start->tv_nsec;
}
/*PAGE
*
* _POSIX_Timespec_to_interval
*/
Watchdog_Interval _POSIX_Timespec_to_interval(
const struct timespec *time
)
{
Watchdog_Interval ticks;
ticks = (time->tv_sec * TOD_MICROSECONDS_PER_SECOND) /
_TOD_Microseconds_per_tick;
ticks += (time->tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND) /
_TOD_Microseconds_per_tick;
if (ticks)
return ticks;
return 1;
}
/*PAGE
*
* _POSIX_Interval_to_timespec
*/
void _POSIX_Interval_to_timespec(
Watchdog_Interval ticks,
struct timespec *time
)
{
unsigned32 usecs;
usecs = ticks * _TOD_Microseconds_per_tick;
time->tv_sec = usecs / TOD_MICROSECONDS_PER_SECOND;
time->tv_nsec = (usecs % TOD_MICROSECONDS_PER_SECOND) *
TOD_NANOSECONDS_PER_MICROSECOND;
}
/*PAGE
*
* 4.5.1 Get System Time, P1003.1b-1993, p. 91
@@ -119,279 +46,3 @@ time_t time(
return seconds_since_epoch;
}
#endif
/*PAGE
*
* 14.2.1 Clocks, P1003.1b-1993, p. 263
*/
int clock_settime(
clockid_t clock_id,
const struct timespec *tp
)
{
struct tm split_time;
TOD_Control tod;
Watchdog_Interval seconds;
assert( tp );
switch ( clock_id ) {
case CLOCK_REALTIME:
(void) gmtime_r( &tp->tv_sec, &split_time );
/*
* Convert the tm structure format to that used by the TOD Handler
*
* NOTE: TOD Handler does not honor leap seconds.
*/
tod.year = split_time.tm_year + 1900; /* RHS is years since 1900 */
tod.month = split_time.tm_mon + 1; /* RHS uses 0-11 */
tod.day = split_time.tm_mday;
tod.hour = split_time.tm_hour;
tod.minute = split_time.tm_min;
tod.second = split_time.tm_sec; /* RHS allows 0-61 for leap seconds */
tod.ticks = (tp->tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND) /
_TOD_Microseconds_per_tick;
if ( !_TOD_Validate( &tod ) )
set_errno_and_return_minus_one( EINVAL );
/*
* We can't use the tp->tv_sec field because it is based on
* a different EPOCH.
*/
seconds = _TOD_To_seconds( &tod );
_Thread_Disable_dispatch();
_TOD_Set( &tod, seconds );
_Thread_Enable_dispatch();
break;
#ifdef _POSIX_CPUTIME
case CLOCK_PROCESS_CPUTIME:
return POSIX_NOT_IMPLEMENTED();
break;
#endif
#ifdef _POSIX_THREAD_CPUTIME
case CLOCK_THREAD_CPUTIME:
return POSIX_NOT_IMPLEMENTED();
break;
#endif
default:
set_errno_and_return_minus_one( EINVAL );
}
return 0;
}
/*PAGE
*
* 14.2.1 Clocks, P1003.1b-1993, p. 263
*/
int clock_gettime(
clockid_t clock_id,
struct timespec *tp
)
{
ISR_Level level;
time_t seconds;
long ticks;
if ( !tp )
set_errno_and_return_minus_one( EINVAL );
switch ( clock_id ) {
case CLOCK_REALTIME:
_ISR_Disable( level );
seconds = _TOD_Seconds_since_epoch;
ticks = _TOD_Current.ticks;
_ISR_Enable( level );
tp->tv_sec = seconds + POSIX_TIME_SECONDS_1970_THROUGH_1988;
tp->tv_nsec = ticks * _TOD_Microseconds_per_tick *
TOD_NANOSECONDS_PER_MICROSECOND;
break;
#ifdef _POSIX_CPUTIME
case CLOCK_PROCESS_CPUTIME:
/* don't base this on _Watchdog_Ticks_since_boot--duration is too short*/
return POSIX_NOT_IMPLEMENTED();
break;
#endif
#ifdef _POSIX_THREAD_CPUTIME
case CLOCK_THREAD_CPUTIME:
return POSIX_NOT_IMPLEMENTED();
break;
#endif
default:
set_errno_and_return_minus_one( EINVAL );
}
return 0;
}
/*PAGE
*
* 14.2.1 Clocks, P1003.1b-1993, p. 263
*/
int clock_getres(
clockid_t clock_id,
struct timespec *res
)
{
if ( !res )
set_errno_and_return_minus_one( EINVAL );
switch ( clock_id ) {
/*
* All time in rtems is based on the same clock tick.
*/
case CLOCK_REALTIME:
case CLOCK_PROCESS_CPUTIME:
case CLOCK_THREAD_CPUTIME:
if ( res )
_POSIX_Interval_to_timespec( _TOD_Microseconds_per_tick, res );
break;
default:
set_errno_and_return_minus_one( EINVAL );
}
return 0;
}
/*PAGE
*
* 14.2.5 High Resolution Sleep, P1003.1b-1993, p. 269
*/
int nanosleep(
const struct timespec *rqtp,
struct timespec *rmtp
)
{
Watchdog_Interval ticks;
struct timespec *the_rqtp;
if ( !rqtp )
set_errno_and_return_minus_one( EINVAL );
the_rqtp = (struct timespec *)rqtp;
/*
* Return EAGAIN if the delay interval is negative.
*
* NOTE: This behavior is beyond the POSIX specification.
* FSU pthreads shares this behavior.
*/
if ( the_rqtp->tv_sec < 0 )
the_rqtp->tv_sec = 0;
if ( /* the_rqtp->tv_sec < 0 || */ the_rqtp->tv_nsec < 0 )
set_errno_and_return_minus_one( EAGAIN );
if ( the_rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND )
set_errno_and_return_minus_one( EINVAL );
ticks = _POSIX_Timespec_to_interval( the_rqtp );
/*
* This behavior is also beyond the POSIX specification but is
* consistent with the RTEMS api and yields desirable behavior.
*/
if ( !ticks ) {
_Thread_Disable_dispatch();
_Thread_Yield_processor();
_Thread_Enable_dispatch();
if ( rmtp ) {
rmtp->tv_sec = 0;
rmtp->tv_nsec = 0;
}
return 0;
}
_Thread_Disable_dispatch();
_Thread_Set_state(
_Thread_Executing,
STATES_DELAYING | STATES_INTERRUPTIBLE_BY_SIGNAL
);
_Watchdog_Initialize(
&_Thread_Executing->Timer,
_Thread_Delay_ended,
_Thread_Executing->Object.id,
NULL
);
_Watchdog_Insert_ticks( &_Thread_Executing->Timer, ticks );
_Thread_Enable_dispatch();
/* calculate time remaining */
if ( rmtp ) {
ticks -=
_Thread_Executing->Timer.stop_time - _Thread_Executing->Timer.start_time;
_POSIX_Interval_to_timespec( ticks, rmtp );
/*
* If there is time remaining, then we were interrupted by a signal.
*/
if ( ticks )
set_errno_and_return_minus_one( EINTR );
}
return 0;
}
/*PAGE
*
* 20.1.3 Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55
*/
int clock_getcpuclockid(
pid_t pid,
clockid_t *clock_id
)
{
return POSIX_NOT_IMPLEMENTED();
}
/*PAGE
*
* 20.1.5 CPU-time Clock Attribute Access, P1003.4b/D8, p. 58
*/
int clock_setenable_attr(
clockid_t clock_id,
int attr
)
{
return POSIX_NOT_IMPLEMENTED();
}
/*PAGE
*
* 20.1.5 CPU-time Clock Attribute Access, P1003.4b/D8, p. 58
*/
int clock_getenable_attr(
clockid_t clock_id,
int *attr
)
{
return POSIX_NOT_IMPLEMENTED();
}