mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-08-25 06:22:23 +08:00
2008-01-31 Joel Sherrill <joel.sherrill@OARcorp.com>
* posix/src/clockgettime.c, posix/src/clocksettime.c, Minor modifications to improve testability. * posix/src/pthreadcreate.c: Add NULL check for thread entry.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2008-01-31 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* posix/src/clockgettime.c, posix/src/clocksettime.c,
|
||||
Minor modifications to improve testability.
|
||||
* posix/src/pthreadcreate.c: Add NULL check for thread entry.
|
||||
|
||||
2008-01-31 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* posix/src/pthreadinitthreads.c: Clean up error paths.
|
||||
|
||||
@@ -36,32 +36,22 @@ int clock_gettime(
|
||||
if ( !tp )
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
switch ( clock_id ) {
|
||||
|
||||
case CLOCK_REALTIME:
|
||||
_TOD_Get(tp);
|
||||
break;
|
||||
|
||||
if ( clock_id == CLOCK_REALTIME )
|
||||
_TOD_Get(tp);
|
||||
#ifdef CLOCK_MONOTONIC
|
||||
case CLOCK_MONOTONIC:
|
||||
_TOD_Get_uptime(tp);
|
||||
break;
|
||||
else if ( clock_id == CLOCK_MONOTONIC )
|
||||
_TOD_Get_uptime(tp);
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX_CPUTIME
|
||||
case CLOCK_PROCESS_CPUTIME:
|
||||
_TOD_Get_uptime(tp);
|
||||
break;
|
||||
else if ( clock_id == CLOCK_PROCESS_CPUTIME )
|
||||
_TOD_Get_uptime(tp);
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX_THREAD_CPUTIME
|
||||
case CLOCK_THREAD_CPUTIME:
|
||||
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||
break;
|
||||
else if ( clock_id == CLOCK_THREAD_CPUTIME )
|
||||
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||
#endif
|
||||
default:
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
else
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -36,31 +36,24 @@ int clock_settime(
|
||||
if ( !tp )
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
switch ( clock_id ) {
|
||||
|
||||
case CLOCK_REALTIME:
|
||||
if ( tp->tv_sec < TOD_SECONDS_1970_THROUGH_1988 )
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
_Thread_Disable_dispatch();
|
||||
_TOD_Set( tp );
|
||||
_Thread_Enable_dispatch();
|
||||
break;
|
||||
|
||||
#ifdef _POSIX_CPUTIME
|
||||
case CLOCK_PROCESS_CPUTIME:
|
||||
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX_THREAD_CPUTIME
|
||||
case CLOCK_THREAD_CPUTIME:
|
||||
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
if ( clock_id == CLOCK_REALTIME ) {
|
||||
if ( tp->tv_sec < TOD_SECONDS_1970_THROUGH_1988 )
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
_Thread_Disable_dispatch();
|
||||
_TOD_Set( tp );
|
||||
_Thread_Enable_dispatch();
|
||||
}
|
||||
#ifdef _POSIX_CPUTIME
|
||||
else if ( clock_id == CLOCK_PROCESS_CPUTIME )
|
||||
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||
#endif
|
||||
#ifdef _POSIX_THREAD_CPUTIME
|
||||
else if ( clock_id == CLOCK_THREAD_CPUTIME )
|
||||
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||
#endif
|
||||
else
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ int pthread_create(
|
||||
struct sched_param schedparam;
|
||||
Objects_Name name;
|
||||
|
||||
if ( !start_routine )
|
||||
return EFAULT;
|
||||
|
||||
the_attr = (attr) ? attr : &_POSIX_Threads_Default_attributes;
|
||||
|
||||
if ( !the_attr->is_initialized )
|
||||
|
||||
Reference in New Issue
Block a user