forked from Imagelibrary/rtems
Remove stray white spaces.
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
#define TM_THURSDAY 4
|
||||
#define TM_FRIDAY 5
|
||||
#define TM_SATURDAY 6
|
||||
|
||||
|
||||
#define TM_JANUARY 0
|
||||
#define TM_FEBRUARY 1
|
||||
#define TM_MARCH 2
|
||||
@@ -39,7 +39,7 @@
|
||||
#define TM_OCTOBER 10
|
||||
#define TM_NOVEMBER 12
|
||||
#define TM_DECEMBER 12
|
||||
|
||||
|
||||
#ifndef build_time
|
||||
#define build_time( TM, WEEKDAY, MON, DAY, YR, HR, MIN, SEC ) \
|
||||
{ (TM)->tm_year = YR; \
|
||||
@@ -65,7 +65,7 @@
|
||||
\
|
||||
status = clock_settime( CLOCK_REALTIME, &tv ); \
|
||||
assert( !status ); \
|
||||
} while ( 0 )
|
||||
} while ( 0 )
|
||||
|
||||
#define print_current_time(s1, s2) \
|
||||
do { \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
@@ -39,7 +39,7 @@ void *POSIX_Init(
|
||||
status = uname( NULL );
|
||||
assert( status == -1 );
|
||||
assert( errno == EFAULT );
|
||||
|
||||
|
||||
status = uname( &uts );
|
||||
assert( !status );
|
||||
printf( "Init: uts.sysname: %s\n", uts.sysname );
|
||||
@@ -48,7 +48,7 @@ void *POSIX_Init(
|
||||
printf( "Init: uts.version: %s\n", uts.version );
|
||||
printf( "Init: uts.machine: %s\n", uts.machine );
|
||||
puts("");
|
||||
|
||||
|
||||
/* error cases in clock_gettime and clock_settime */
|
||||
|
||||
puts( "Init: clock_gettime - EINVAL (invalid clockid)" );
|
||||
@@ -113,7 +113,7 @@ void *POSIX_Init(
|
||||
printf( ctime( &seconds ) );
|
||||
|
||||
/* just to have the value copied out through the parameter */
|
||||
|
||||
|
||||
seconds = time( &seconds1 );
|
||||
assert( seconds == seconds1 );
|
||||
|
||||
@@ -146,10 +146,10 @@ void *POSIX_Init(
|
||||
|
||||
/* use nanosleep to yield */
|
||||
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_nsec = 0;
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_nsec = 0;
|
||||
|
||||
puts( "Init: nanosleep - yield" );
|
||||
puts( "Init: nanosleep - yield" );
|
||||
status = nanosleep ( &tv, &tr );
|
||||
assert( !status );
|
||||
assert( !tr.tv_sec );
|
||||
@@ -157,10 +157,10 @@ void *POSIX_Init(
|
||||
|
||||
/* use nanosleep to delay */
|
||||
|
||||
tv.tv_sec = 3;
|
||||
tv.tv_nsec = 500000;
|
||||
tv.tv_sec = 3;
|
||||
tv.tv_nsec = 500000;
|
||||
|
||||
puts( "Init: nanosleep - 3.05 seconds" );
|
||||
puts( "Init: nanosleep - 3.05 seconds" );
|
||||
status = nanosleep ( &tv, &tr );
|
||||
assert( !status );
|
||||
|
||||
@@ -168,7 +168,7 @@ void *POSIX_Init(
|
||||
|
||||
status = clock_gettime( CLOCK_REALTIME, &tv );
|
||||
assert( !status );
|
||||
|
||||
|
||||
printf( ctime( &tv.tv_sec ) );
|
||||
|
||||
/* check the time remaining */
|
||||
@@ -193,7 +193,7 @@ void *POSIX_Init(
|
||||
assert( errno == EINVAL );
|
||||
|
||||
/* exercise get maximum priority */
|
||||
|
||||
|
||||
priority = sched_get_priority_max( SCHED_FIFO );
|
||||
printf( "Init: sched_get_priority_max (SCHED_FIFO) -- %d\n", priority );
|
||||
assert( priority != -1 );
|
||||
@@ -204,7 +204,7 @@ void *POSIX_Init(
|
||||
assert( errno == EINVAL );
|
||||
|
||||
/* print the round robin time quantum */
|
||||
|
||||
|
||||
status = sched_rr_get_interval( getpid(), &tr );
|
||||
printf(
|
||||
"Init: Round Robin quantum is %ld seconds, %ld nanoseconds\n",
|
||||
@@ -212,7 +212,7 @@ void *POSIX_Init(
|
||||
tr.tv_nsec
|
||||
);
|
||||
assert( !status );
|
||||
|
||||
|
||||
/* create a thread */
|
||||
|
||||
puts( "Init: pthread_create - SUCCESSFUL" );
|
||||
|
||||
@@ -36,7 +36,7 @@ void *Task_1_through_3(
|
||||
puts( "Task_1: sched_yield to Init" );
|
||||
status = sched_yield();
|
||||
assert( !status );
|
||||
|
||||
|
||||
/* switch to Task_1 */
|
||||
|
||||
/* now do some real testing */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
@@ -59,7 +59,7 @@ void *POSIX_Init(
|
||||
|
||||
act.sa_handler = Signal_handler;
|
||||
act.sa_flags = 0;
|
||||
|
||||
|
||||
sigaction( SIGUSR1, &act, NULL );
|
||||
|
||||
/* simple signal to self */
|
||||
@@ -87,8 +87,8 @@ void *POSIX_Init(
|
||||
status = sigpending( &pending_set );
|
||||
assert( !status );
|
||||
printf( "Init: Signals pending 0x%08x\n", (unsigned int) pending_set );
|
||||
|
||||
|
||||
|
||||
|
||||
printf( "Init: send SIGUSR1 to self\n" );
|
||||
status = pthread_kill( Init_id, SIGUSR1 );
|
||||
assert( !status );
|
||||
@@ -96,7 +96,7 @@ void *POSIX_Init(
|
||||
status = sigpending( &pending_set );
|
||||
assert( !status );
|
||||
printf( "Init: Signals pending 0x%08x\n", (unsigned int) pending_set );
|
||||
|
||||
|
||||
printf( "Init: Unblock SIGUSR1\n" );
|
||||
status = sigprocmask( SIG_UNBLOCK, &mask, NULL );
|
||||
assert( !status );
|
||||
@@ -107,26 +107,26 @@ void *POSIX_Init(
|
||||
assert( !status );
|
||||
|
||||
/*
|
||||
* Loop for 5 seconds seeing how many signals we catch
|
||||
* Loop for 5 seconds seeing how many signals we catch
|
||||
*/
|
||||
|
||||
tr.tv_sec = 5;
|
||||
tr.tv_nsec = 0;
|
||||
|
||||
|
||||
do {
|
||||
tv = tr;
|
||||
|
||||
Signal_occurred = 0;
|
||||
|
||||
status = nanosleep ( &tv, &tr );
|
||||
|
||||
|
||||
if ( status == -1 ) {
|
||||
assert( errno == EINTR );
|
||||
assert( tr.tv_nsec || tr.tv_sec );
|
||||
} else if ( !status ) {
|
||||
assert( !tr.tv_nsec && !tr.tv_sec );
|
||||
}
|
||||
|
||||
|
||||
printf(
|
||||
"Init: signal was %sprocessed with %d:%d time remaining\n",
|
||||
(Signal_occurred) ? "" : "not ",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
@@ -61,7 +61,7 @@ void *POSIX_Init(
|
||||
|
||||
act.sa_handler = Signal_handler;
|
||||
act.sa_flags = 0;
|
||||
|
||||
|
||||
sigaction( SIGUSR1, &act, NULL );
|
||||
|
||||
/* initialize signal handler variables */
|
||||
@@ -70,7 +70,7 @@ void *POSIX_Init(
|
||||
Signal_occurred = 0;
|
||||
|
||||
/*
|
||||
* wait on SIGUSR1 for 3 seconds, will timeout
|
||||
* wait on SIGUSR1 for 3 seconds, will timeout
|
||||
*/
|
||||
|
||||
/* initialize the signal set we will wait for to SIGUSR1 */
|
||||
@@ -88,7 +88,7 @@ void *POSIX_Init(
|
||||
signo = sigtimedwait( &waitset, &siginfo, &timeout );
|
||||
assert( signo == -1 );
|
||||
|
||||
if ( errno == EAGAIN )
|
||||
if ( errno == EAGAIN )
|
||||
puts( "Init: correctly timed out waiting for SIGUSR1." );
|
||||
else
|
||||
printf( "sigtimedwait returned wrong errno - %d\n", errno );
|
||||
@@ -119,10 +119,10 @@ void *POSIX_Init(
|
||||
assert( !status );
|
||||
|
||||
/* signal handler is still installed, waitset is still set for SIGUSR1 */
|
||||
|
||||
|
||||
timeout.tv_sec = 3;
|
||||
timeout.tv_nsec = 0;
|
||||
|
||||
|
||||
puts( "Init: waiting on any signal for 3 seconds." );
|
||||
signo = sigtimedwait( &waitset, &siginfo, &timeout );
|
||||
|
||||
@@ -133,7 +133,7 @@ void *POSIX_Init(
|
||||
else
|
||||
printf( "sigtimedwait returned wrong errno - %d\n", errno );
|
||||
assert( signo == -1 );
|
||||
|
||||
|
||||
/*
|
||||
* wait on SIGUSR1 for 3 seconds, Task_2 will send it to us
|
||||
*/
|
||||
@@ -146,12 +146,12 @@ void *POSIX_Init(
|
||||
assert( !status );
|
||||
|
||||
/* signal handler is still installed, waitset is still set for SIGUSR1 */
|
||||
|
||||
|
||||
/* wait on SIGUSR1 for 3 seconds, will receive SIGUSR1 from Task_2 */
|
||||
|
||||
|
||||
timeout.tv_sec = 3;
|
||||
timeout.tv_nsec = 0;
|
||||
|
||||
|
||||
/* just so we can check that these were altered */
|
||||
|
||||
siginfo.si_code = -1;
|
||||
@@ -165,7 +165,7 @@ void *POSIX_Init(
|
||||
assert( siginfo.si_signo == SIGUSR1 );
|
||||
assert( siginfo.si_code == SI_USER );
|
||||
assert( siginfo.si_value.sival_int != -1 ); /* rtems does always set this */
|
||||
|
||||
|
||||
/* try out a process signal */
|
||||
|
||||
empty_line();
|
||||
|
||||
@@ -49,13 +49,13 @@ void *Task_2(
|
||||
int status;
|
||||
|
||||
/* send SIGUSR1 to Init which is waiting on SIGUSR1 */
|
||||
|
||||
|
||||
print_current_time( "Task_2: ", "" );
|
||||
|
||||
puts( "Task_1: pthread_kill - SIGUSR1 to Init" );
|
||||
status = pthread_kill( Init_id, SIGUSR1 );
|
||||
assert( !status );
|
||||
|
||||
|
||||
pthread_exit( NULL );
|
||||
|
||||
/* switch to Init */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
@@ -108,7 +108,7 @@ void *POSIX_Init(
|
||||
|
||||
act.sa_handler = Signal_handler;
|
||||
act.sa_flags = 0;
|
||||
|
||||
|
||||
sigaction( SIGUSR1, &act, NULL );
|
||||
|
||||
/* simple signal to process */
|
||||
@@ -137,7 +137,7 @@ void *POSIX_Init(
|
||||
puts( "Init: Block SIGUSR1" );
|
||||
act.sa_handler = Signal_handler;
|
||||
act.sa_flags = 0;
|
||||
|
||||
|
||||
sigaction( SIGUSR1, &act, NULL );
|
||||
|
||||
/* simple signal to process */
|
||||
@@ -168,7 +168,7 @@ void *POSIX_Init(
|
||||
status = sigpending( &pending_set );
|
||||
assert( !status );
|
||||
printf( "Init: Signals pending 0x%08x\n", (unsigned int) pending_set );
|
||||
|
||||
|
||||
puts( "Init: send SIGUSR1 to process" );
|
||||
status = kill( getpid(), SIGUSR1 );
|
||||
assert( !status );
|
||||
@@ -176,7 +176,7 @@ void *POSIX_Init(
|
||||
status = sigpending( &pending_set );
|
||||
assert( !status );
|
||||
printf( "Init: Signals pending 0x%08x\n", (unsigned int) pending_set );
|
||||
|
||||
|
||||
puts( "Init: Unblock SIGUSR1" );
|
||||
status = sigprocmask( SIG_UNBLOCK, &mask, NULL );
|
||||
assert( !status );
|
||||
@@ -192,12 +192,12 @@ void *POSIX_Init(
|
||||
puts( "Init: Block SIGUSR1" );
|
||||
status = sigprocmask( SIG_BLOCK, &mask, NULL );
|
||||
assert( !status );
|
||||
|
||||
|
||||
status = sigpending( &pending_set );
|
||||
assert( !status );
|
||||
printf( "Init: Signals pending 0x%08x\n", (unsigned int) pending_set );
|
||||
|
||||
puts( "Init: sleep so the other task can block" );
|
||||
puts( "Init: sleep so the other task can block" );
|
||||
status = sleep( 1 );
|
||||
assert( !status );
|
||||
|
||||
@@ -206,12 +206,12 @@ void *POSIX_Init(
|
||||
puts( "Init: send SIGUSR1 to process" );
|
||||
status = kill( getpid(), SIGUSR1 );
|
||||
assert( !status );
|
||||
|
||||
|
||||
status = sigpending( &pending_set );
|
||||
assert( !status );
|
||||
printf( "Init: Signals pending 0x%08x\n", (unsigned int) pending_set );
|
||||
|
||||
puts( "Init: sleep so the other task can catch signal" );
|
||||
puts( "Init: sleep so the other task can catch signal" );
|
||||
status = sleep( 1 );
|
||||
assert( !status );
|
||||
|
||||
@@ -222,27 +222,27 @@ void *POSIX_Init(
|
||||
empty_line();
|
||||
|
||||
/* install a signal handler for SIGALRM and unblock it */
|
||||
|
||||
|
||||
status = sigemptyset( &act.sa_mask );
|
||||
assert( !status );
|
||||
|
||||
|
||||
act.sa_handler = Signal_handler;
|
||||
act.sa_flags = 0;
|
||||
|
||||
|
||||
sigaction( SIGALRM, &act, NULL );
|
||||
|
||||
|
||||
status = sigemptyset( &mask );
|
||||
assert( !status );
|
||||
|
||||
|
||||
status = sigaddset( &mask, SIGALRM );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: Unblock SIGALRM" );
|
||||
status = sigprocmask( SIG_UNBLOCK, &mask, NULL );
|
||||
assert( !status );
|
||||
|
||||
/* schedule the alarm */
|
||||
|
||||
|
||||
puts( "Init: Firing alarm in 5 seconds" );
|
||||
status = alarm( 5 );
|
||||
printf( "Init: %d seconds left on previous alarm\n", status );
|
||||
@@ -264,7 +264,7 @@ void *POSIX_Init(
|
||||
|
||||
status = sigemptyset( &mask );
|
||||
assert( !status );
|
||||
|
||||
|
||||
status = sigaddset( &mask, SIGUSR1 );
|
||||
assert( !status );
|
||||
|
||||
@@ -277,7 +277,7 @@ void *POSIX_Init(
|
||||
assert( !status );
|
||||
|
||||
/* test inquiry about current blocked set with pthread_sigmask */
|
||||
|
||||
|
||||
status = pthread_sigmask( 0, NULL, &oset );
|
||||
printf( "Init: Current blocked set is 0x%08x\n", (unsigned int) oset );
|
||||
assert( !status );
|
||||
@@ -286,7 +286,7 @@ void *POSIX_Init(
|
||||
|
||||
status = sigemptyset( &mask );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: Unblock all signals" );
|
||||
status = pthread_sigmask( SIG_SETMASK, &mask, &oset );
|
||||
printf( "Init: Previous blocked set was 0x%08x\n", (unsigned int) oset );
|
||||
@@ -302,7 +302,7 @@ void *POSIX_Init(
|
||||
|
||||
status = sigemptyset( &mask );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: sigsuspend for any signal" );
|
||||
status = sigsuspend( &mask );
|
||||
assert( status );
|
||||
@@ -320,10 +320,10 @@ void *POSIX_Init(
|
||||
act.sa_handler = Signal_handler;
|
||||
act.sa_flags = SA_SIGINFO;
|
||||
act.sa_sigaction = Signal_info_handler;
|
||||
|
||||
|
||||
sigaction( SIGUSR1, &act, NULL );
|
||||
|
||||
puts( "Init: sleep so the Task_3 can sigqueue SIGUSR1" );
|
||||
puts( "Init: sleep so the Task_3 can sigqueue SIGUSR1" );
|
||||
status = sleep( 1 );
|
||||
assert( !status );
|
||||
|
||||
@@ -347,46 +347,46 @@ void *POSIX_Init(
|
||||
status = kill( getpid(), SIGUSR1 );
|
||||
assert( !status );
|
||||
|
||||
puts( "Init: sleep so the Task_3 can receive SIGUSR1" );
|
||||
puts( "Init: sleep so the Task_3 can receive SIGUSR1" );
|
||||
status = sleep( 1 );
|
||||
assert( !status );
|
||||
|
||||
/* Send SIGUSR1, Task_3 has issued a sigwait */
|
||||
|
||||
|
||||
status = sigemptyset( &mask );
|
||||
assert( !status );
|
||||
|
||||
|
||||
status = sigaddset( &mask, SIGUSR1 );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: Block SIGUSR1" );
|
||||
status = sigprocmask( SIG_BLOCK, &mask, NULL );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: send SIGUSR1 to process" );
|
||||
status = kill( getpid(), SIGUSR1 );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: sleep so the Task_3 can receive SIGUSR1" );
|
||||
status = sleep( 1 );
|
||||
assert( !status );
|
||||
|
||||
/* Send SIGUSR1, Task_3 has issued a sigwaitinfo */
|
||||
|
||||
|
||||
status = sigemptyset( &mask );
|
||||
assert( !status );
|
||||
|
||||
|
||||
status = sigaddset( &mask, SIGUSR2 );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: Block SIGUSR2" );
|
||||
status = sigprocmask( SIG_BLOCK, &mask, NULL );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: send SIGUSR2 to process" );
|
||||
status = kill( getpid(), SIGUSR2 );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: sleep so the Task_3 can receive SIGUSR2" );
|
||||
status = sleep( 1 );
|
||||
assert( !status );
|
||||
@@ -435,11 +435,11 @@ void *POSIX_Init(
|
||||
printf( "status = %d\n", status );
|
||||
assert( errno == EINVAL );
|
||||
puts( "Init: sigdelset - EINVAL (set invalid)" );
|
||||
|
||||
|
||||
status = sigdelset( &mask, 0 );
|
||||
assert( !status );
|
||||
puts( "Init: sigdelset - SUCCESSFUL (signal = 0)" );
|
||||
|
||||
|
||||
status = sigdelset( &mask, 999 );
|
||||
if ( status != -1 )
|
||||
printf( "status = %d\n", status );
|
||||
@@ -451,11 +451,11 @@ void *POSIX_Init(
|
||||
printf( "status = %d\n", status );
|
||||
assert( errno == EINVAL );
|
||||
puts( "Init: sigismember - EINVAL (set invalid)" );
|
||||
|
||||
|
||||
status = sigismember( &mask, 0 );
|
||||
assert( !status );
|
||||
puts( "Init: sigismember - SUCCESSFUL (signal = 0)" );
|
||||
|
||||
|
||||
status = sigismember( &mask, 999 );
|
||||
if ( status != -1 )
|
||||
printf( "status = %d\n", status );
|
||||
@@ -465,7 +465,7 @@ void *POSIX_Init(
|
||||
status = sigaction( 0, &act, 0 );
|
||||
assert( !status );
|
||||
puts( "Init: sigaction - SUCCESSFUL (signal = 0)" );
|
||||
|
||||
|
||||
status = sigaction( 999, &act, NULL );
|
||||
if ( status != -1 )
|
||||
printf( "status = %d\n", status );
|
||||
|
||||
@@ -65,36 +65,36 @@ void *Task_3(
|
||||
|
||||
status = sigemptyset( &mask );
|
||||
assert( !status );
|
||||
|
||||
|
||||
status = sigaddset( &mask, SIGUSR1 );
|
||||
assert( !status );
|
||||
|
||||
|
||||
printf( "Task_3: sigwait SIGUSR1\n" );
|
||||
status = sigwait( &mask, &sig );
|
||||
|
||||
|
||||
/* switch to Init */
|
||||
|
||||
|
||||
assert( !status );
|
||||
printf( "Task_3: signo= %d\n", sig );
|
||||
|
||||
/* catch signal with pause */
|
||||
|
||||
|
||||
empty_line();
|
||||
|
||||
status = sigemptyset( &mask );
|
||||
assert( !status );
|
||||
|
||||
|
||||
status = sigaddset( &mask, SIGUSR1 );
|
||||
assert( !status );
|
||||
|
||||
|
||||
printf( "Task_3: pause\n" );
|
||||
status = pause( );
|
||||
|
||||
|
||||
/* switch to Init */
|
||||
|
||||
|
||||
assert( !(status==-1) );
|
||||
printf( "Task_3: pause= %d\n", status );
|
||||
|
||||
|
||||
|
||||
/* send signal to Init task before it has pended for a signal */
|
||||
|
||||
@@ -104,7 +104,7 @@ void *Task_3(
|
||||
status = pthread_kill( Init_id, SIGUSR2 );
|
||||
assert( !status );
|
||||
|
||||
printf( "Task_3: sleep so the Init task can reguest a signal\n" );
|
||||
printf( "Task_3: sleep so the Init task can reguest a signal\n" );
|
||||
status = sleep( 1 );
|
||||
assert( !status );
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "system.h"
|
||||
#include <errno.h>
|
||||
|
||||
#define MUTEX_BAD_ID 0xfffffffe
|
||||
#define MUTEX_BAD_ID 0xfffffffe
|
||||
|
||||
void Print_mutexattr(
|
||||
char *msg,
|
||||
@@ -88,7 +88,7 @@ void *POSIX_Init(
|
||||
int old_ceiling;
|
||||
|
||||
assert( MUTEX_BAD_ID != PTHREAD_MUTEX_INITIALIZER );
|
||||
Mutex_bad_id = MUTEX_BAD_ID;
|
||||
Mutex_bad_id = MUTEX_BAD_ID;
|
||||
|
||||
puts( "\n\n*** POSIX TEST 5 ***" );
|
||||
|
||||
@@ -100,7 +100,7 @@ void *POSIX_Init(
|
||||
|
||||
Init_id = pthread_self();
|
||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
||||
|
||||
|
||||
/* tes pthread_mutex_attr_init */
|
||||
|
||||
puts( "Init: pthread_mutexattr_init - EINVAL (NULL attr)" );
|
||||
@@ -137,11 +137,11 @@ void *POSIX_Init(
|
||||
puts( "Init: pthread_mutexattr_getpshared - EINVAL (NULL attr)" );
|
||||
status = pthread_mutexattr_getpshared( NULL, &pshared );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutexattr_getpshared - EINVAL (NULL pshared)" );
|
||||
status = pthread_mutexattr_getpshared( &attr, NULL );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutexattr_getpshared - EINVAL (not initialized)" );
|
||||
status = pthread_mutexattr_getpshared( &destroyed_attr, &pshared );
|
||||
assert( status == EINVAL );
|
||||
@@ -150,7 +150,7 @@ void *POSIX_Init(
|
||||
puts( "Init: pthread_mutexattr_setpshared - EINVAL (NULL attr)" );
|
||||
status = pthread_mutexattr_setpshared( NULL, pshared );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
pshared = PTHREAD_PROCESS_PRIVATE;
|
||||
puts( "Init: pthread_mutexattr_setpshared - EINVAL (not initialized)" );
|
||||
status = pthread_mutexattr_setpshared( &destroyed_attr, pshared );
|
||||
@@ -163,23 +163,23 @@ void *POSIX_Init(
|
||||
puts( "Init: pthread_mutexattr_getprotocol - EINVAL (NULL attr)" );
|
||||
status = pthread_mutexattr_getprotocol( NULL, &protocol );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutexattr_getprotocol - EINVAL (NULL protocol)" );
|
||||
status = pthread_mutexattr_getprotocol( &attr, NULL );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutexattr_getprotocol - EINVAL (not initialized)" );
|
||||
status = pthread_mutexattr_getprotocol( &destroyed_attr, &protocol );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutexattr_setprotocol - EINVAL (NULL attr)" );
|
||||
status = pthread_mutexattr_setprotocol( NULL, PTHREAD_PRIO_NONE );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutexattr_setprotocol - EINVAL (invalid protocol)" );
|
||||
status = pthread_mutexattr_setprotocol( &attr, -1 );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutexattr_setprotocol - EINVAL (not initialized)" );
|
||||
status = pthread_mutexattr_setprotocol( &destroyed_attr, -1 );
|
||||
assert( status == EINVAL );
|
||||
@@ -187,29 +187,29 @@ void *POSIX_Init(
|
||||
/* error cases for set and get prioceiling attribute */
|
||||
|
||||
empty_line();
|
||||
|
||||
|
||||
puts( "Init: pthread_mutexattr_getprioceiling - EINVAL (NULL attr)" );
|
||||
status = pthread_mutexattr_getprioceiling( NULL, &ceiling );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutexattr_getprioceiling - EINVAL (NULL prioceiling)" );
|
||||
status = pthread_mutexattr_getprioceiling( &attr, NULL );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutexattr_getprioceiling - EINVAL (not initialized)" );
|
||||
status = pthread_mutexattr_getprioceiling( &destroyed_attr, &ceiling );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutexattr_setprioceiling - EINVAL (NULL attr)" );
|
||||
status = pthread_mutexattr_setprioceiling( NULL, 128 );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutexattr_setprioceiling - EINVAL (invalid priority)" );
|
||||
status = pthread_mutexattr_setprioceiling( &attr, 512 );
|
||||
if ( status != EINVAL )
|
||||
printf( "status = %d\n", status );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutexattr_setprioceiling - EINVAL (not initialized)" );
|
||||
status = pthread_mutexattr_setprioceiling( &destroyed_attr, -1 );
|
||||
assert( status == EINVAL );
|
||||
@@ -255,15 +255,15 @@ void *POSIX_Init(
|
||||
puts( "Init: Changing mutex attributes" );
|
||||
status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_INHERIT );
|
||||
assert( !status );
|
||||
|
||||
|
||||
status = pthread_mutexattr_setprioceiling( &attr, 128 );
|
||||
assert( !status );
|
||||
|
||||
|
||||
status = pthread_mutexattr_setpshared( &attr, PTHREAD_PROCESS_SHARED );
|
||||
assert( !status );
|
||||
|
||||
|
||||
Print_mutexattr( "Init: ", &attr );
|
||||
|
||||
|
||||
puts( "Init: Resetting mutex attributes" );
|
||||
status = pthread_mutexattr_init( &attr );
|
||||
assert( !status );
|
||||
@@ -275,7 +275,7 @@ void *POSIX_Init(
|
||||
|
||||
status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_INHERIT );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutex_init - SUCCESSFUL" );
|
||||
status = pthread_mutex_init( &Mutex_id, &attr );
|
||||
if ( status )
|
||||
@@ -322,7 +322,7 @@ void *POSIX_Init(
|
||||
puts( "Init: Sleep 1 second" );
|
||||
|
||||
sleep( 1 );
|
||||
|
||||
|
||||
/* switch to task 1 */
|
||||
|
||||
puts( "Init: pthread_mutex_unlock - EINVAL (invalid id)" );
|
||||
@@ -376,15 +376,15 @@ void *POSIX_Init(
|
||||
puts( "Init: pthread_mutex_destroy - SUCCESSFUL" );
|
||||
status = pthread_mutex_destroy( &Mutex2_id );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutex_destroy - EINVAL (invalid id)" );
|
||||
status = pthread_mutex_destroy( &Mutex_bad_id );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
/* destroy a busy mutex */
|
||||
|
||||
|
||||
empty_line();
|
||||
|
||||
|
||||
puts( "Init: pthread_mutexattr_init - SUCCESSFUL" );
|
||||
status = pthread_mutexattr_init( &attr );
|
||||
assert( !status );
|
||||
@@ -392,7 +392,7 @@ void *POSIX_Init(
|
||||
puts( "Init: pthread_mutex_init - SUCCESSFUL" );
|
||||
status = pthread_mutex_init( &Mutex2_id, &attr );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutex_trylock - SUCCESSFUL" );
|
||||
status = pthread_mutex_trylock( &Mutex2_id );
|
||||
if ( status )
|
||||
@@ -416,7 +416,7 @@ void *POSIX_Init(
|
||||
/* priority inherit mutex */
|
||||
|
||||
empty_line();
|
||||
|
||||
|
||||
puts( "Init: pthread_mutexattr_init - SUCCESSFUL" );
|
||||
status = pthread_mutexattr_init( &attr );
|
||||
assert( !status );
|
||||
@@ -436,14 +436,14 @@ void *POSIX_Init(
|
||||
assert( !status );
|
||||
|
||||
/* create a thread at a lower priority */
|
||||
|
||||
|
||||
status = pthread_create( &Task2_id, NULL, Task_2, NULL );
|
||||
assert( !status );
|
||||
|
||||
|
||||
/* set priority of Task2 to highest priority */
|
||||
|
||||
|
||||
param.sched_priority = 254;
|
||||
|
||||
|
||||
puts( "Init: pthread_setschedparam - Setting Task2 priority to highest" );
|
||||
status = pthread_setschedparam( Task2_id, SCHED_FIFO, ¶m );
|
||||
assert( !status );
|
||||
@@ -457,7 +457,7 @@ void *POSIX_Init(
|
||||
puts( "Init: pthread_mutex_unlock - SUCCESSFUL" );
|
||||
status = pthread_mutex_unlock( &Mutex2_id );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutexattr_destroy - SUCCESSFUL" );
|
||||
status = pthread_mutexattr_destroy( &attr );
|
||||
assert( !status );
|
||||
@@ -465,25 +465,25 @@ void *POSIX_Init(
|
||||
puts( "Init: pthread_mutex_destroy - SUCCESSFUL" );
|
||||
status = pthread_mutex_destroy( &Mutex2_id );
|
||||
assert( !status );
|
||||
|
||||
|
||||
/* priority ceiling mutex */
|
||||
|
||||
|
||||
empty_line();
|
||||
|
||||
|
||||
puts( "Init: pthread_mutexattr_init - SUCCESSFUL" );
|
||||
status = pthread_mutexattr_init( &attr );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts(
|
||||
"Init: pthread_mutexattr_setprotocol - SUCCESSFUL (PTHREAD_PRIO_PROTECT)"
|
||||
);
|
||||
status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_PROTECT );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutex_init - SUCCESSFUL" );
|
||||
status = pthread_mutex_init( &Mutex2_id, &attr );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutex_getprioceiling - EINVAL (invalid id)" );
|
||||
status = pthread_mutex_getprioceiling( &Mutex_bad_id, &ceiling );
|
||||
assert( status == EINVAL );
|
||||
@@ -495,7 +495,7 @@ void *POSIX_Init(
|
||||
status = pthread_mutex_getprioceiling( &Mutex2_id, &ceiling );
|
||||
assert( !status );
|
||||
printf( "Init: pthread_mutex_getprioceiling - %d\n", ceiling );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutex_setprioceiling - EINVAL (invalid id)" );
|
||||
status = pthread_mutex_setprioceiling( &Mutex_bad_id, 200, &old_ceiling );
|
||||
assert( status == EINVAL );
|
||||
@@ -516,7 +516,7 @@ void *POSIX_Init(
|
||||
printf(
|
||||
"Init: pthread_mutex_setprioceiling - old ceiling = %d\n",old_ceiling
|
||||
);
|
||||
|
||||
|
||||
status = pthread_getschedparam( pthread_self(), &policy, ¶m );
|
||||
assert( !status );
|
||||
printf(
|
||||
@@ -526,7 +526,7 @@ void *POSIX_Init(
|
||||
puts( "Init: pthread_mutex_trylock - SUCCESSFUL" );
|
||||
status = pthread_mutex_trylock( &Mutex2_id );
|
||||
assert( !status );
|
||||
|
||||
|
||||
status = pthread_getschedparam( pthread_self(), &policy, ¶m );
|
||||
assert( !status );
|
||||
printf(
|
||||
@@ -534,42 +534,42 @@ void *POSIX_Init(
|
||||
);
|
||||
|
||||
/* create a thread at a higher priority */
|
||||
|
||||
|
||||
status = pthread_create( &Task3_id, NULL, Task_3, NULL );
|
||||
assert( !status );
|
||||
|
||||
|
||||
/* set priority of Task3 to highest priority */
|
||||
|
||||
|
||||
param.sched_priority = 199;
|
||||
|
||||
|
||||
status = pthread_setschedparam( Task3_id, SCHED_FIFO, ¶m );
|
||||
assert( !status );
|
||||
puts( "Init: pthread_setschedparam - set Task3 priority to highest" );
|
||||
|
||||
|
||||
/* DOES NOT SWITCH to Task3 */
|
||||
|
||||
puts( "Init: Sleep 1 second" );
|
||||
assert( !status );
|
||||
sleep( 1 );
|
||||
|
||||
|
||||
/* switch to task 3 */
|
||||
|
||||
|
||||
puts( "Init: pthread_mutex_unlock - SUCCESSFUL" );
|
||||
status = pthread_mutex_unlock( &Mutex2_id );
|
||||
assert( !status );
|
||||
|
||||
|
||||
status = pthread_mutex_getprioceiling( &Mutex2_id, &ceiling );
|
||||
assert( !status );
|
||||
printf( "Init: pthread_mutex_getprioceiling- ceiling = %d\n", ceiling );
|
||||
|
||||
|
||||
/* set priority of Init to highest priority */
|
||||
|
||||
|
||||
param.sched_priority = 254;
|
||||
|
||||
|
||||
status = pthread_setschedparam( Init_id, SCHED_FIFO, ¶m );
|
||||
assert( !status );
|
||||
puts( "Init: pthread_setschedparam - set Init priority to highest" );
|
||||
|
||||
|
||||
puts( "Init: pthread_mutex_lock - EINVAL (priority ceiling violation)" );
|
||||
status = pthread_mutex_lock( &Mutex2_id );
|
||||
if ( status != EINVAL )
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
@@ -46,7 +46,7 @@ void *POSIX_Init(
|
||||
|
||||
Init_id = pthread_self();
|
||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
||||
|
||||
|
||||
/* create a couple of threads */
|
||||
|
||||
status = pthread_create( &Task_id, NULL, Task_1, NULL );
|
||||
|
||||
@@ -26,14 +26,14 @@ void *Task_1(
|
||||
)
|
||||
{
|
||||
int status;
|
||||
uint32_t *key_data;
|
||||
uint32_t *key_data;
|
||||
|
||||
printf( "Task_1: Setting the key to %d\n", 1 );
|
||||
status = pthread_setspecific( Key_id, &Data_array[ 1 ] );
|
||||
if ( status )
|
||||
printf( "status = %d\n", status );
|
||||
assert( !status );
|
||||
|
||||
|
||||
key_data = pthread_getspecific( Key_id );
|
||||
printf( "Task_1: Got the key value of %ld\n",
|
||||
(unsigned long) ((uint32_t *)key_data - Data_array) );
|
||||
|
||||
@@ -26,7 +26,7 @@ void *Task_2(
|
||||
{
|
||||
int status;
|
||||
uint32_t *key_data;
|
||||
|
||||
|
||||
printf( "Destructor invoked %d times\n", Destructor_invoked );
|
||||
|
||||
printf( "Task_2: Setting the key to %d\n", 2 );
|
||||
@@ -34,18 +34,18 @@ void *Task_2(
|
||||
if ( status )
|
||||
printf( "status = %d\n", status );
|
||||
assert( !status );
|
||||
|
||||
|
||||
key_data = pthread_getspecific( Key_id );
|
||||
printf( "Task_2: Got the key value of %ld\n",
|
||||
(unsigned long) ((uint32_t *)key_data - Data_array) );
|
||||
if ( status )
|
||||
printf( "status = %d\n", status );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Task2: exitting" );
|
||||
pthread_exit( NULL );
|
||||
|
||||
|
||||
/* switch to init task */
|
||||
|
||||
|
||||
return NULL; /* just so the compiler thinks we returned something */
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
@@ -18,7 +18,7 @@ void print_schedparam(
|
||||
struct sched_param *schedparam
|
||||
)
|
||||
{
|
||||
printf( "%ssched priority = %d\n", prefix, schedparam->sched_priority );
|
||||
printf( "%ssched priority = %d\n", prefix, schedparam->sched_priority );
|
||||
#if defined(_POSIX_SPORADIC_SERVER)
|
||||
printf( "%sss_low_priority = %d\n", prefix, schedparam->ss_low_priority );
|
||||
printf( "%sss_replenish_period = (%ld, %ld)\n", prefix,
|
||||
@@ -31,7 +31,7 @@ void print_schedparam(
|
||||
printf( "%s_POSIX_SPORADIC_SERVER is not defined\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void *POSIX_Init(
|
||||
void *argument
|
||||
)
|
||||
@@ -57,7 +57,7 @@ void *POSIX_Init(
|
||||
|
||||
Init_id = pthread_self();
|
||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
||||
|
||||
|
||||
/* exercise init and destroy */
|
||||
|
||||
puts( "Init: pthread_attr_init - EINVAL (NULL attr)" );
|
||||
@@ -92,10 +92,10 @@ void *POSIX_Init(
|
||||
/* junk stack address */
|
||||
status = pthread_attr_setstackaddr( &attr, (void *)&schedparam );
|
||||
assert( !status );
|
||||
|
||||
|
||||
/* must go around pthread_attr_setstacksize to set a bad stack size */
|
||||
attr.stacksize = 0;
|
||||
|
||||
|
||||
puts( "Init: pthread_create - EINVAL (stacksize too small)" );
|
||||
status = pthread_create( &Task_id, &attr, Task_1, NULL );
|
||||
assert( status == EINVAL );
|
||||
@@ -114,7 +114,7 @@ void *POSIX_Init(
|
||||
|
||||
/* must go around pthread_attr_set routines to set a bad value */
|
||||
attr.inheritsched = -1;
|
||||
|
||||
|
||||
puts( "Init: pthread_create - EINVAL (invalid inherit scheduler)" );
|
||||
status = pthread_create( &Task_id, &attr, Task_1, NULL );
|
||||
assert( status == EINVAL );
|
||||
@@ -138,7 +138,7 @@ void *POSIX_Init(
|
||||
|
||||
status = pthread_attr_setinheritsched( &attr, PTHREAD_INHERIT_SCHED );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_create - SUCCESSFUL (inherit scheduler)" );
|
||||
status = pthread_create( &Task_id, &attr, Task_1, NULL );
|
||||
assert( !status );
|
||||
@@ -174,19 +174,19 @@ void *POSIX_Init(
|
||||
puts( "Init: pthread_attr_setscope - SUCCESSFUL" );
|
||||
status = pthread_attr_setscope( &attr, PTHREAD_SCOPE_PROCESS );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getscope - EINVAL (NULL attr)" );
|
||||
status = pthread_attr_getscope( NULL, &scope );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getscope - EINVAL (NULL scope)" );
|
||||
status = pthread_attr_getscope( &attr, NULL );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getscope - EINVAL (not initialized attr)" );
|
||||
status = pthread_attr_getscope( &destroyed_attr, &scope );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getscope - SUCCESSFUL" );
|
||||
status = pthread_attr_getscope( &attr, &scope );
|
||||
assert( !status );
|
||||
@@ -199,88 +199,88 @@ void *POSIX_Init(
|
||||
puts( "Init: pthread_attr_setinheritsched - EINVAL (NULL attr)" );
|
||||
status = pthread_attr_setinheritsched( NULL, PTHREAD_INHERIT_SCHED );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setinheritsched - EINVAL (not initialized attr)" );
|
||||
status =
|
||||
pthread_attr_setinheritsched( &destroyed_attr, PTHREAD_INHERIT_SCHED );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setinheritsched - ENOTSUP (invalid inheritsched)" );
|
||||
status = pthread_attr_setinheritsched( &attr, -1 );
|
||||
assert( status == ENOTSUP );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setinheritsched - SUCCESSFUL" );
|
||||
status = pthread_attr_setinheritsched( &attr, PTHREAD_INHERIT_SCHED );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getinheritsched - EINVAL (NULL attr)" );
|
||||
status = pthread_attr_getinheritsched( NULL, &inheritsched );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getinheritsched - EINVAL (NULL inheritsched)" );
|
||||
status = pthread_attr_getinheritsched( &attr, NULL );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getinheritsched - EINVAL (not initialized attr)" );
|
||||
status = pthread_attr_getinheritsched( &destroyed_attr, &inheritsched );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getinheritsched - SUCCESSFUL" );
|
||||
status = pthread_attr_getinheritsched( &attr, &inheritsched );
|
||||
assert( !status );
|
||||
printf( "Init: current inherit scheduler attribute = %d\n", inheritsched );
|
||||
|
||||
/* exercise get and set inherit scheduler */
|
||||
|
||||
|
||||
empty_line();
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setschedpolicy - EINVAL (NULL attr)" );
|
||||
status = pthread_attr_setschedpolicy( NULL, SCHED_FIFO );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setschedpolicy - EINVAL (not initialized attr)" );
|
||||
status =
|
||||
pthread_attr_setschedpolicy( &destroyed_attr, SCHED_OTHER );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setschedpolicy - ENOTSUP (invalid schedpolicy)" );
|
||||
status = pthread_attr_setschedpolicy( &attr, -1 );
|
||||
assert( status == ENOTSUP );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setschedpolicy - SUCCESSFUL" );
|
||||
status = pthread_attr_setschedpolicy( &attr, SCHED_RR );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getschedpolicy - EINVAL (NULL attr)" );
|
||||
status = pthread_attr_getschedpolicy( NULL, &schedpolicy );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getschedpolicy - EINVAL (NULL schedpolicy)" );
|
||||
status = pthread_attr_getschedpolicy( &attr, NULL );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getschedpolicy - EINVAL (not initialized attr)" );
|
||||
status = pthread_attr_getschedpolicy( &destroyed_attr, &schedpolicy );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getschedpolicy - SUCCESSFUL" );
|
||||
status = pthread_attr_getschedpolicy( &attr, &schedpolicy );
|
||||
assert( !status );
|
||||
printf( "Init: current scheduler policy attribute = %d\n", schedpolicy );
|
||||
|
||||
|
||||
/* exercise get and set stack size */
|
||||
|
||||
|
||||
empty_line();
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setstacksize - EINVAL (NULL attr)" );
|
||||
status = pthread_attr_setstacksize( NULL, 0 );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setstacksize - EINVAL (not initialized attr)" );
|
||||
status =
|
||||
pthread_attr_setstacksize( &destroyed_attr, 0 );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setstacksize - SUCCESSFUL (low stacksize)" );
|
||||
status = pthread_attr_setstacksize( &attr, 0 );
|
||||
assert( !status );
|
||||
@@ -288,19 +288,19 @@ void *POSIX_Init(
|
||||
puts( "Init: pthread_attr_setstacksize - SUCCESSFUL (high stacksize)" );
|
||||
status = pthread_attr_setstacksize( &attr, STACK_MINIMUM_SIZE * 2 );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getstacksize - EINVAL (NULL attr)" );
|
||||
status = pthread_attr_getstacksize( NULL, &stacksize );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getstacksize - EINVAL (NULL stacksize)" );
|
||||
status = pthread_attr_getstacksize( &attr, NULL );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getstacksize - EINVAL (not initialized attr)" );
|
||||
status = pthread_attr_getstacksize( &destroyed_attr, &stacksize );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getstacksize - SUCCESSFUL" );
|
||||
status = pthread_attr_getstacksize( &attr, &stacksize );
|
||||
assert( !status );
|
||||
@@ -308,72 +308,72 @@ void *POSIX_Init(
|
||||
printf( "Init: current stack size attribute is OK\n" );
|
||||
|
||||
/* exercise get and set stack address */
|
||||
|
||||
|
||||
empty_line();
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setstackaddr - EINVAL (NULL attr)" );
|
||||
status = pthread_attr_setstackaddr( NULL, NULL );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setstackaddr - EINVAL (not initialized attr)" );
|
||||
status =
|
||||
pthread_attr_setstackaddr( &destroyed_attr, NULL );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setstackaddr - SUCCESSFUL" );
|
||||
status = pthread_attr_setstackaddr( &attr, 0 );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getstackaddr - EINVAL (NULL attr)" );
|
||||
status = pthread_attr_getstackaddr( NULL, &stackaddr );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getstackaddr - EINVAL (NULL stackaddr)" );
|
||||
status = pthread_attr_getstackaddr( &attr, NULL );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getstackaddr - EINVAL (not initialized attr)" );
|
||||
status = pthread_attr_getstackaddr( &destroyed_attr, &stackaddr );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getstackaddr - SUCCESSFUL" );
|
||||
status = pthread_attr_getstackaddr( &attr, &stackaddr );
|
||||
assert( !status );
|
||||
printf( "Init: current stack address attribute = %p\n", stackaddr );
|
||||
|
||||
|
||||
/* exercise get and set detach state */
|
||||
|
||||
|
||||
empty_line();
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setdetachstate - EINVAL (NULL attr)" );
|
||||
status = pthread_attr_setdetachstate( NULL, PTHREAD_CREATE_DETACHED );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setdetachstate - EINVAL (not initialized attr)" );
|
||||
status =
|
||||
pthread_attr_setdetachstate( &destroyed_attr, PTHREAD_CREATE_JOINABLE );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setdetachstate - EINVAL (invalid detachstate)" );
|
||||
status = pthread_attr_setdetachstate( &attr, -1 );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setdetachstate - SUCCESSFUL" );
|
||||
status = pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getdetachstate - EINVAL (NULL attr)" );
|
||||
status = pthread_attr_getdetachstate( NULL, &detachstate );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getdetachstate - EINVAL (NULL detatchstate)" );
|
||||
status = pthread_attr_getdetachstate( &attr, NULL );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getdetachstate - EINVAL (not initialized attr)" );
|
||||
status = pthread_attr_getdetachstate( &destroyed_attr, &detachstate );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getdetachstate - SUCCESSFUL" );
|
||||
status = pthread_attr_getdetachstate( &attr, &detachstate );
|
||||
assert( !status );
|
||||
@@ -392,31 +392,31 @@ void *POSIX_Init(
|
||||
puts( "Init: pthread_attr_setschedparam - EINVAL (NULL attr)" );
|
||||
status = pthread_attr_setschedparam( NULL, &schedparam );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setschedparam - EINVAL (not initialized attr)" );
|
||||
status = pthread_attr_setschedparam( &destroyed_attr, &schedparam );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setschedparam - EINVAL (NULL schedparam)" );
|
||||
status = pthread_attr_setschedparam( &attr, NULL );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_setschedparam - SUCCESSFUL" );
|
||||
status = pthread_attr_setschedparam( &attr, &schedparam );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getschedparam - EINVAL (NULL attr)" );
|
||||
status = pthread_attr_getschedparam( NULL, &schedparam );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getschedparam - EINVAL (not initialized attr)" );
|
||||
status = pthread_attr_getschedparam( &destroyed_attr, &schedparam );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_attr_getschedparam - EINVAL (NULL schedparam)" );
|
||||
status = pthread_attr_getschedparam( &attr, NULL );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
/* exercise pthread_getschedparam */
|
||||
|
||||
empty_line();
|
||||
@@ -424,19 +424,19 @@ void *POSIX_Init(
|
||||
puts( "Init: pthread_getschedparam - EINVAL (NULL policy)" );
|
||||
status = pthread_getschedparam( pthread_self(), NULL, &schedparam );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_getschedparam - EINVAL (NULL schedparam)" );
|
||||
status = pthread_getschedparam( pthread_self(), &schedpolicy, NULL );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Init: pthread_getschedparam - ESRCH (bad thread)" );
|
||||
status = pthread_getschedparam( -1, &schedpolicy, &schedparam );
|
||||
assert( status == ESRCH );
|
||||
|
||||
|
||||
puts( "Init: pthread_getschedparam - SUCCESSFUL" );
|
||||
status = pthread_getschedparam( pthread_self(), &schedpolicy, &schedparam );
|
||||
assert( !status );
|
||||
|
||||
|
||||
printf( "Init: policy = %d\n", schedpolicy );
|
||||
|
||||
print_schedparam( "Init: ", &schedparam );
|
||||
@@ -465,7 +465,7 @@ void *POSIX_Init(
|
||||
status = pthread_setschedparam( -1, SCHED_OTHER, &schedparam );
|
||||
assert( status == ESRCH );
|
||||
|
||||
/* now get sporadic server errors */
|
||||
/* now get sporadic server errors */
|
||||
|
||||
schedparam.ss_replenish_period.tv_sec = 1;
|
||||
schedparam.ss_replenish_period.tv_nsec = 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
@@ -42,10 +42,10 @@ void *POSIX_Init(
|
||||
assert( !status );
|
||||
|
||||
/* create thread */
|
||||
|
||||
|
||||
status = pthread_create( &Task1_id, NULL, Task_1, NULL );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_join - ESRCH (invalid id)" );
|
||||
status = pthread_join( -1, &return_pointer );
|
||||
assert( status == ESRCH );
|
||||
@@ -66,14 +66,14 @@ void *POSIX_Init(
|
||||
return_pointer,
|
||||
&Task1_id
|
||||
);
|
||||
|
||||
|
||||
puts( "Init: creating two pthreads" );
|
||||
status = pthread_create( &Task2_id, NULL, Task_2, NULL );
|
||||
assert( !status );
|
||||
|
||||
|
||||
status = pthread_create( &Task3_id, NULL, Task_3, NULL );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_join - SUCCESSFUL" );
|
||||
status = pthread_join( Task2_id, &return_pointer );
|
||||
/* assert is below comment */
|
||||
@@ -91,7 +91,7 @@ void *POSIX_Init(
|
||||
return_pointer,
|
||||
&Task2_id
|
||||
);
|
||||
|
||||
|
||||
puts( "Init: exitting" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ void *Task_2(
|
||||
if ( status != EINVAL )
|
||||
printf( "status = %d\n", status );
|
||||
assert( status == EINVAL );
|
||||
|
||||
|
||||
puts( "Task_2: join to self task (Init) -- EDEADLK" );
|
||||
status = pthread_join( pthread_self(), NULL );
|
||||
if ( status != EDEADLK )
|
||||
|
||||
@@ -34,7 +34,7 @@ void *Task_3(
|
||||
if ( status )
|
||||
printf( "status = %d\n", status );
|
||||
assert( !status );
|
||||
|
||||
|
||||
if ( return_pointer == &Task2_id )
|
||||
puts( "Task_3: pthread_join returned correct pointer" );
|
||||
else
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
@@ -54,7 +54,7 @@ void *POSIX_Init(
|
||||
|
||||
Init_id = pthread_self();
|
||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
||||
|
||||
|
||||
/* try to use this thread as a sporadic server */
|
||||
|
||||
puts( "Init: pthread_getschedparam - SUCCESSFUL" );
|
||||
@@ -89,7 +89,7 @@ void *POSIX_Init(
|
||||
for ( passes=0 ; passes <= 3 ; ) {
|
||||
status = pthread_getschedparam( pthread_self(), &schedpolicy, &schedparam );
|
||||
assert( !status );
|
||||
|
||||
|
||||
if ( priority != schedparam.sched_priority ) {
|
||||
priority = schedparam.sched_priority;
|
||||
sprintf( buffer, " - new priority = %d", priority );
|
||||
@@ -117,7 +117,7 @@ void *POSIX_Init(
|
||||
|
||||
schedparam.sched_priority = HIGH_PRIORITY;
|
||||
schedparam.ss_low_priority = LOW_PRIORITY;
|
||||
|
||||
|
||||
puts( "Init: pthread_setschedparam - SUCCESSFUL (sporadic server)" );
|
||||
status = pthread_setschedparam( pthread_self(), SCHED_SPORADIC, &schedparam );
|
||||
assert( !status );
|
||||
@@ -128,10 +128,10 @@ void *POSIX_Init(
|
||||
|
||||
status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_PROTECT );
|
||||
assert( !status );
|
||||
|
||||
|
||||
status = pthread_mutexattr_setprioceiling( &attr, MEDIUM_PRIORITY );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: Creating a mutex" );
|
||||
status = pthread_mutex_init( &Mutex_id, &attr );
|
||||
if ( status )
|
||||
@@ -140,7 +140,7 @@ void *POSIX_Init(
|
||||
|
||||
status = pthread_getschedparam( pthread_self(), &schedpolicy, &schedparam );
|
||||
assert( !status );
|
||||
|
||||
|
||||
priority = schedparam.sched_priority;
|
||||
sprintf( buffer, " - new priority = %d", priority );
|
||||
print_current_time( "Init: ", buffer );
|
||||
@@ -179,18 +179,18 @@ void *POSIX_Init(
|
||||
for ( ; ; ) {
|
||||
status = pthread_getschedparam( pthread_self(), &schedpolicy, &schedparam );
|
||||
assert( !status );
|
||||
|
||||
|
||||
if ( schedparam.sched_priority == HIGH_PRIORITY )
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
priority = schedparam.sched_priority;
|
||||
sprintf( buffer, " - new priority = %d", priority );
|
||||
print_current_time( "Init: ", buffer );
|
||||
|
||||
|
||||
/* with this unlock we should be able to go to low priority */
|
||||
|
||||
puts( "Init: unlock mutex" );
|
||||
puts( "Init: unlock mutex" );
|
||||
status = pthread_mutex_unlock( &Mutex_id );
|
||||
if ( status )
|
||||
printf( "status = %d\n", status );
|
||||
@@ -206,14 +206,14 @@ void *POSIX_Init(
|
||||
for ( ; ; ) {
|
||||
status = pthread_getschedparam( pthread_self(), &schedpolicy, &schedparam );
|
||||
assert( !status );
|
||||
|
||||
|
||||
if ( schedparam.sched_priority == LOW_PRIORITY )
|
||||
break;
|
||||
}
|
||||
|
||||
status = pthread_getschedparam( pthread_self(), &schedpolicy, &schedparam );
|
||||
assert( !status );
|
||||
|
||||
|
||||
priority = schedparam.sched_priority;
|
||||
sprintf( buffer, " - new priority = %d", priority );
|
||||
print_current_time( "Init: ", buffer );
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
@@ -221,7 +221,7 @@ void *POSIX_Init(
|
||||
printf( "status = %d\n", status );
|
||||
assert( status == EINVAL );
|
||||
puts( "Init: pthread_cond_wait - EINVAL (mutex invalid)" );
|
||||
|
||||
|
||||
status = pthread_cond_timedwait( &Cond1_id, NULL, &timeout );
|
||||
if ( status != EINVAL )
|
||||
printf( "status = %d\n", status );
|
||||
@@ -261,7 +261,7 @@ void *POSIX_Init(
|
||||
/* wait and timedwait without mutex */
|
||||
|
||||
/* XXX - this case is commented out in the code pending review
|
||||
*
|
||||
*
|
||||
* status = pthread_cond_wait( &Cond1_id, &Mutex_id );
|
||||
* if ( status != EINVAL )
|
||||
* printf( "status = %d\n", status );
|
||||
@@ -270,7 +270,7 @@ void *POSIX_Init(
|
||||
puts( "Init: pthread_cond_wait - EINVAL (mutex not locked before call)" );
|
||||
|
||||
/* XXX - this case is commented out in the code pending review
|
||||
*
|
||||
*
|
||||
* status = clock_gettime( CLOCK_REALTIME, &timeout );
|
||||
* assert( !status );
|
||||
* timeout.tv_sec += 1;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
@@ -31,7 +31,7 @@ void *POSIX_Init(
|
||||
|
||||
Init_id = pthread_self();
|
||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
||||
|
||||
|
||||
/* exercise pthread_setschedparam */
|
||||
|
||||
param.sched_priority = 127;
|
||||
@@ -53,33 +53,33 @@ void *POSIX_Init(
|
||||
assert( !status );
|
||||
|
||||
/* create a thread as SCHED_FIFO */
|
||||
|
||||
|
||||
puts( "Init: create a thread of SCHED_FIFO with priority 120" );
|
||||
status = pthread_attr_init( &attr );
|
||||
assert( !status );
|
||||
|
||||
|
||||
attr.schedpolicy = SCHED_FIFO;
|
||||
attr.schedparam.sched_priority = 120;
|
||||
|
||||
|
||||
status = pthread_create( &Task_id, &attr, Task_1, NULL );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: join with the other thread" );
|
||||
status = pthread_join( Task_id, NULL );
|
||||
assert( !status );
|
||||
|
||||
/* create a thread as SCHED_RR */
|
||||
|
||||
|
||||
puts( "Init: create a thread of SCHED_RR with priority 120" );
|
||||
status = pthread_attr_init( &attr );
|
||||
assert( !status );
|
||||
|
||||
|
||||
attr.schedpolicy = SCHED_RR;
|
||||
attr.schedparam.sched_priority = 120;
|
||||
|
||||
|
||||
status = pthread_create( &Task_id, &attr, Task_1, NULL );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: join with the other thread" );
|
||||
status = pthread_join( Task_id, NULL );
|
||||
assert( !status );
|
||||
|
||||
@@ -29,14 +29,14 @@ void diff_timespec(
|
||||
)
|
||||
{
|
||||
int nsecs_per_sec = 1000000000;
|
||||
|
||||
|
||||
result->tv_sec = stop->tv_sec - start->tv_sec;
|
||||
if ( stop->tv_nsec < start->tv_nsec ) {
|
||||
result->tv_nsec = nsecs_per_sec - start->tv_nsec + stop->tv_nsec;
|
||||
result->tv_sec--;
|
||||
} else
|
||||
result->tv_nsec = stop->tv_nsec - start->tv_nsec;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void *Task_1(
|
||||
@@ -51,7 +51,7 @@ void *Task_1(
|
||||
|
||||
status = clock_gettime( CLOCK_REALTIME, &start );
|
||||
assert( !status );
|
||||
|
||||
|
||||
status = sched_rr_get_interval( getpid(), &delay );
|
||||
assert( !status );
|
||||
|
||||
@@ -63,8 +63,8 @@ void *Task_1(
|
||||
delay.tv_nsec -= 1000000000;
|
||||
delay.tv_sec++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
puts( "Task_1: killing time" );
|
||||
for ( ; ; ) {
|
||||
|
||||
@@ -78,10 +78,10 @@ void *Task_1(
|
||||
|
||||
if ( difference.tv_sec > delay.tv_sec )
|
||||
break;
|
||||
|
||||
|
||||
if ( difference.tv_nsec > delay.tv_nsec )
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
puts( "Task_1: exitting" );
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
@@ -50,7 +50,7 @@ void *POSIX_Init(
|
||||
|
||||
Init_id = pthread_self();
|
||||
printf( "Init's ID is 0x%08x\n", Init_id );
|
||||
|
||||
|
||||
/* invalid scheduling policy error */
|
||||
|
||||
puts( "Init: pthread_attr_init - SUCCESSFUL" );
|
||||
@@ -79,7 +79,7 @@ void *POSIX_Init(
|
||||
schedparam.ss_replenish_period.tv_nsec = 0;
|
||||
schedparam.ss_initial_budget.tv_sec = 2;
|
||||
schedparam.ss_initial_budget.tv_nsec = 0;
|
||||
|
||||
|
||||
schedparam.sched_priority = 200;
|
||||
schedparam.ss_low_priority = 100;
|
||||
|
||||
@@ -88,7 +88,7 @@ void *POSIX_Init(
|
||||
|
||||
status = pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_create - EINVAL (replenish < budget)" );
|
||||
status = pthread_create( &Task_id, &attr, Task_1, NULL );
|
||||
assert( status == EINVAL );
|
||||
@@ -99,7 +99,7 @@ void *POSIX_Init(
|
||||
schedparam.ss_replenish_period.tv_nsec = 0;
|
||||
schedparam.ss_initial_budget.tv_sec = 1;
|
||||
schedparam.ss_initial_budget.tv_nsec = 0;
|
||||
|
||||
|
||||
schedparam.sched_priority = 200;
|
||||
schedparam.ss_low_priority = -1;
|
||||
|
||||
@@ -116,13 +116,13 @@ void *POSIX_Init(
|
||||
schedparam.ss_replenish_period.tv_nsec = 0;
|
||||
schedparam.ss_initial_budget.tv_sec = 1;
|
||||
schedparam.ss_initial_budget.tv_nsec = 0;
|
||||
|
||||
|
||||
schedparam.sched_priority = 200;
|
||||
schedparam.ss_low_priority = 100;
|
||||
|
||||
|
||||
status = pthread_attr_setschedparam( &attr, &schedparam );
|
||||
assert( !status );
|
||||
|
||||
|
||||
puts( "Init: pthread_create - SUCCESSFUL" );
|
||||
status = pthread_create( &Task_id, &attr, Task_1, NULL );
|
||||
assert( !status );
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Psx13
|
||||
* Chris Bond (working under Jennifer's account)
|
||||
*
|
||||
@@ -40,8 +40,8 @@
|
||||
/*-------------------------------------------------------------------
|
||||
* InitFiles function
|
||||
*
|
||||
* Initializes the three files to be used in the test.
|
||||
*
|
||||
* Initializes the three files to be used in the test.
|
||||
*
|
||||
* arguments: none
|
||||
* assumptions: fopen, fprintf, fwrite, FILE are available
|
||||
* actions: creates testfile1, a text file with 'a'..'z' listed 4 times.
|
||||
@@ -49,7 +49,7 @@
|
||||
* creates testfile3, a binary file with 0..9 listed 4 times.
|
||||
* returns: TRUE if files opened successfully.
|
||||
* FALSE if fail on file open for write.
|
||||
*
|
||||
*
|
||||
* ------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@@ -77,7 +77,7 @@ int InitFiles (void) {
|
||||
if (letter > 'z')
|
||||
letter = 'a';
|
||||
}
|
||||
|
||||
|
||||
number = 0;
|
||||
|
||||
for (count = 0; count <40; ++count) {
|
||||
@@ -96,7 +96,7 @@ int InitFiles (void) {
|
||||
retval = TRUE;
|
||||
}
|
||||
|
||||
else
|
||||
else
|
||||
retval = FALSE;
|
||||
|
||||
/* assert (retval == TRUE);*/
|
||||
@@ -111,7 +111,7 @@ int InitFiles (void) {
|
||||
*
|
||||
* arguments: none
|
||||
* assumptions: lseek available
|
||||
* actions: hits lseek with some dummy arguments.
|
||||
* actions: hits lseek with some dummy arguments.
|
||||
* returns: value of return from lseek.
|
||||
*
|
||||
* ---------------------------------------------------------------
|
||||
@@ -146,7 +146,7 @@ int DeviceLSeekTest (void) {
|
||||
* actions: Gets a file descriptor(fd1) for test file1.
|
||||
* dups fd1 to fd2.
|
||||
* sets fd1 to append mode
|
||||
* checks fd2 to ensure it's in append mode, also.
|
||||
* checks fd2 to ensure it's in append mode, also.
|
||||
* returns: success if fd2 is indeed a copy of fd1.
|
||||
*
|
||||
* ---------------------------------------------------------------
|
||||
@@ -169,7 +169,7 @@ int DupTest(void) {
|
||||
close (fd1);
|
||||
|
||||
flags = (flags & O_APPEND);
|
||||
|
||||
|
||||
retval = (flags == O_APPEND);
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ int DupTest(void) {
|
||||
* actions: Gets a file descriptor(fd1) for test file1.
|
||||
* dups fd1 to fd2.
|
||||
* sets fd1 to append mode
|
||||
* checks fd2 to ensure it's in append mode, also.
|
||||
* checks fd2 to ensure it's in append mode, also.
|
||||
* sets fd1 to invalid value, fd2 to valid, tries to dup2.
|
||||
* sets fd2 to invalid value, fd1 to valid tries to dup2.
|
||||
* returns: success if fd2 is a copy of fd1, and invalid fd1 or fd2 produce errors.
|
||||
@@ -240,14 +240,14 @@ int Dup2Test(void) {
|
||||
else {
|
||||
fd1 = dup(fd2);
|
||||
fd2 = -1;
|
||||
|
||||
|
||||
if (dup2(fd1, fd2) != -1)
|
||||
retval = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
close (fd1);
|
||||
|
||||
|
||||
/* assert (retval == TRUE);*/
|
||||
|
||||
return (retval);
|
||||
@@ -276,9 +276,9 @@ int FDataSyncTest(void) {
|
||||
|
||||
int fd = -1;
|
||||
int error = 0, retval = TRUE;
|
||||
|
||||
|
||||
/* Try it with a RD_ONLY file. */
|
||||
|
||||
|
||||
fd = open ("testfile1.tst", O_RDONLY);
|
||||
|
||||
error = fdatasync(fd);
|
||||
@@ -286,7 +286,7 @@ int FDataSyncTest(void) {
|
||||
retval = TRUE;
|
||||
else
|
||||
retval = FALSE;
|
||||
|
||||
|
||||
close (fd);
|
||||
|
||||
if (retval == TRUE) {
|
||||
@@ -314,7 +314,7 @@ int FDataSyncTest(void) {
|
||||
retval = FALSE;
|
||||
|
||||
close (fd);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* assert (retval == TRUE);*/
|
||||
@@ -359,7 +359,7 @@ int UMaskTest (void) {
|
||||
/* ---------------------------------------------------------------
|
||||
* UTimeTest function
|
||||
*
|
||||
* Hits the utime code. Does NOT test the functionality of the underlying utime
|
||||
* Hits the utime code. Does NOT test the functionality of the underlying utime
|
||||
* entry in the IMFS op table.
|
||||
*
|
||||
* arguments: none
|
||||
@@ -402,7 +402,7 @@ int UTimeTest (void) {
|
||||
|
||||
if ((fstat.st_atime == 12345) && (fstat.st_mtime == 54321 ))
|
||||
retval = TRUE;
|
||||
else
|
||||
else
|
||||
retval = FALSE;
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ int PipeTest (void) {
|
||||
|
||||
int error = 0, retval = FALSE;
|
||||
int fd[2];
|
||||
|
||||
|
||||
error = pipe(fd);
|
||||
|
||||
if ((error == -1) && (errno == ENOSYS))
|
||||
@@ -479,8 +479,8 @@ int PathConfTest (void) {
|
||||
else
|
||||
retval = FALSE;
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
else
|
||||
retval = FALSE;
|
||||
|
||||
/* assert (retval == TRUE);*/
|
||||
@@ -498,7 +498,7 @@ int PathConfTest (void) {
|
||||
* assumptions: fpathconf function available.
|
||||
* actions: Call fpathconf with all arguments, plus an invalid.
|
||||
*
|
||||
* returns: TRUE always.
|
||||
* returns: TRUE always.
|
||||
*
|
||||
* ---------------------------------------------------------------
|
||||
*/
|
||||
@@ -513,7 +513,7 @@ int FPathConfTest (void) {
|
||||
|
||||
if (error == -1) {
|
||||
fd = open("testfile1.tst", O_RDWR);
|
||||
|
||||
|
||||
error = fpathconf(fd, _PC_LINK_MAX);
|
||||
error = fpathconf(fd, _PC_MAX_CANON);
|
||||
error = fpathconf(fd, _PC_MAX_INPUT);
|
||||
@@ -521,17 +521,17 @@ int FPathConfTest (void) {
|
||||
error = fpathconf(fd, _PC_PATH_MAX);
|
||||
error = fpathconf(fd, _PC_PIPE_BUF);
|
||||
error = fpathconf(fd, _PC_CHOWN_RESTRICTED);
|
||||
error = fpathconf(fd, _PC_NO_TRUNC);
|
||||
error = fpathconf(fd, _PC_NO_TRUNC);
|
||||
error = fpathconf(fd, _PC_VDISABLE);
|
||||
error = fpathconf(fd, _PC_ASYNC_IO);
|
||||
error = fpathconf(fd, _PC_PRIO_IO);
|
||||
error = fpathconf(fd, _PC_SYNC_IO);
|
||||
error = fpathconf(fd, 255);
|
||||
|
||||
|
||||
retval = TRUE;
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
else
|
||||
retval = FALSE;
|
||||
|
||||
/* assert (retval == TRUE);*/
|
||||
@@ -560,7 +560,7 @@ int FSyncTest (void) {
|
||||
|
||||
int error = 0, retval = FALSE;
|
||||
int fd = -1;
|
||||
|
||||
|
||||
fd = open("testfile1.tst", O_RDWR);
|
||||
|
||||
if (fd != -1) {
|
||||
@@ -575,7 +575,7 @@ int FSyncTest (void) {
|
||||
close(fd);
|
||||
}
|
||||
|
||||
else
|
||||
else
|
||||
retval = FALSE;
|
||||
|
||||
/* assert (retval == TRUE);*/
|
||||
@@ -589,7 +589,7 @@ int FSyncTest (void) {
|
||||
*
|
||||
* main entry point to the test
|
||||
*
|
||||
* ---------------------------------------------------------------
|
||||
* ---------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if defined(__rtems__)
|
||||
@@ -617,7 +617,7 @@ int main(
|
||||
printf ("Success.\n");
|
||||
else
|
||||
printf ("Failed!!!\n");
|
||||
|
||||
|
||||
printf ("Testing dup2()........... ");
|
||||
if (Dup2Test() == TRUE)
|
||||
printf ("Success.\n");
|
||||
@@ -659,7 +659,7 @@ int main(
|
||||
printf ("Success.\n");
|
||||
else
|
||||
printf ("Failed!!!\n");
|
||||
|
||||
|
||||
printf ("Testing fpathconf()...... ");
|
||||
if (FPathConfTest() == TRUE)
|
||||
printf ("Success.\n");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Thread Test Program
|
||||
*
|
||||
*
|
||||
* - test of POSIX's pthread_init() function from rtemstask Init()
|
||||
*
|
||||
* ott@linux.thai.net
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
* This is a native test to explore how the readdir() family works.
|
||||
* Newlib supports the following readdir() family members:
|
||||
*
|
||||
* closedir() -
|
||||
* readdir() -
|
||||
* scandir() -
|
||||
* opendir() -
|
||||
* rewinddir() -
|
||||
* telldir() - BSD not in POSIX
|
||||
* closedir() -
|
||||
* readdir() -
|
||||
* scandir() -
|
||||
* opendir() -
|
||||
* rewinddir() -
|
||||
* telldir() - BSD not in POSIX
|
||||
* seekdir() - BSD not in POSIX
|
||||
*
|
||||
*
|
||||
@@ -96,19 +96,19 @@ int main(
|
||||
|
||||
touch( "/one/one.test" );
|
||||
touch( "/one/two/two.test" );
|
||||
|
||||
|
||||
status = chroot( "/one" );
|
||||
assert( status == 0 );
|
||||
|
||||
status = fileexists( "/one/one.test" );
|
||||
printf( "%s on /one/one.test\n", (!status) ? "SUCCESS" : "FAILURE" );
|
||||
|
||||
|
||||
status = fileexists( "/two/two.test" );
|
||||
printf( "%s on /two/two.test\n", (status) ? "SUCCESS" : "FAILURE" );
|
||||
|
||||
puts( "Reset the private environment" );
|
||||
rtems_libio_set_private_env();
|
||||
|
||||
|
||||
status = fileexists( "/one/one.test" );
|
||||
printf( "%s on /one/one.test\n", ( status) ? "SUCCESS" : "FAILURE" );
|
||||
|
||||
|
||||
@@ -438,7 +438,7 @@ int main(
|
||||
while ( fgets(buffer, 128, file) )
|
||||
printf( "%s", buffer );
|
||||
|
||||
/*
|
||||
/*
|
||||
* Verify only atime changed for a read.
|
||||
*/
|
||||
status = stat( "/tmp/j", &buf );
|
||||
@@ -464,7 +464,7 @@ int main(
|
||||
status = truncate( "/tmp/j", 40 );
|
||||
assert( !status );
|
||||
|
||||
/*
|
||||
/*
|
||||
* Verify truncate changed only atime.
|
||||
*/
|
||||
status = stat( "/tmp/j", &buf );
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* A test support function which performs a crude version of
|
||||
* A test support function which performs a crude version of
|
||||
* "cat" so you can look at specific parts of a file.
|
||||
*
|
||||
* $Id$
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* A test support function which extends the file to the specified
|
||||
* A test support function which extends the file to the specified
|
||||
* length. This handles the implied open(), lseek(), write(), and close()
|
||||
* operations.
|
||||
*
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_TIMERS
|
||||
#error "rtems is supposed to have clock_gettime"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_TIMERS
|
||||
#error "rtems is supposed to have clock_settime"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_TIMERS
|
||||
#error "rtems is supposed to have clock_getres"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_CPUTIME
|
||||
#error "rtems is supposed to have clock_getcpuclockid"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_CPUTIME
|
||||
#error "rtems is supposed to have clock_setenable_attr"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_CPUTIME
|
||||
#error "rtems is supposed to have clock_getenable_attr"
|
||||
#endif
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_condattr_init"
|
||||
#endif
|
||||
|
||||
|
||||
void test( void )
|
||||
{
|
||||
pthread_condattr_t attribute;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_condattr_destroy"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_cond_init"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_cond_destroy"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_cond_signal"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_cond_wait"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_cond_timedwait"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_condattr_getpshared"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_condattr_setpshared"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_cond_broadcast"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_key_create"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_setspecific"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_getspecific"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_key_delete"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_mutexattr_init"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_mutexattr_destroy"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_mutex_init"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_mutex_destroy"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_mutex_lock"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_mutex_unlock"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIO_INHERIT
|
||||
#error "rtems is supposed to have pthread_mutexattr_setprotocol"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIO_INHERIT
|
||||
#error "rtems is supposed to have pthread_mutexattr_getprioceiling"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIO_INHERIT
|
||||
#error "rtems is supposed to have pthread_mutexattr_setprioceiling"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_mutexattr_getpshared"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_mutexattr_setpshared"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_mutex_trylock"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_mutex_timedlock"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIO_INHERIT
|
||||
#error "rtems is supposed to have pthread_mutexattr_getprotocol"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIO_INHERIT
|
||||
#error "rtems is supposed to have pthread_mutex_getprioceiling"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIO_INHERIT
|
||||
#error "rtems is supposed to have pthread_mutex_setprioceiling"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
void test( void )
|
||||
{
|
||||
pid_t pid;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
void test( void )
|
||||
{
|
||||
pid_t pid;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
void test( void )
|
||||
{
|
||||
uid_t uid;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
void test( void )
|
||||
{
|
||||
uid_t uid;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
void test( void )
|
||||
{
|
||||
gid_t gid;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
void test( void )
|
||||
{
|
||||
gid_t gid;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
void test( void )
|
||||
{
|
||||
uid_t uid;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
void test( void )
|
||||
{
|
||||
gid_t gid;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
void test( void )
|
||||
{
|
||||
gid_t grouplist[ 20 ];
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
void test( void )
|
||||
{
|
||||
char *loginname;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <limits.h> /* for LOGIN_NAME_MAX */
|
||||
|
||||
|
||||
void test( void )
|
||||
{
|
||||
char loginnamebuffer[ LOGIN_NAME_MAX ];
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
void test( void )
|
||||
{
|
||||
pid_t pgrp;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
void test( void )
|
||||
{
|
||||
pid_t pid;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
void test( void )
|
||||
{
|
||||
pid_t pid = 0;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_attr_init"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_attr_setdetachstate"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_attr_getdetachstate"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_getstacksize"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_create"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_self"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_equal"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
#error "RTEMS is supposed to have pthread_setschedparam"
|
||||
#endif
|
||||
@@ -38,7 +38,7 @@ void test( void )
|
||||
* really should use sched_get_priority_min() and sched_get_priority_max()
|
||||
*/
|
||||
|
||||
param.sched_priority = 0;
|
||||
param.sched_priority = 0;
|
||||
#ifdef _POSIX_SPORADIC_SERVER
|
||||
param.ss_low_priority = 0;
|
||||
param.ss_replenish_period.tv_sec = 0;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
#error "RTEMS is supposed to have pthread_getschedparam"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
#error "RTEMS is supposed to have pthread_attr_setscope"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
#error "RTEMS is supposed to have pthread_attr_getscope"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
#error "RTEMS is supposed to have pthread_attr_setinheritsched"
|
||||
#endif
|
||||
@@ -26,6 +26,6 @@ void test( void )
|
||||
|
||||
inheritsched = PTHREAD_INHERIT_SCHED;
|
||||
inheritsched = PTHREAD_EXPLICIT_SCHED;
|
||||
|
||||
|
||||
result = pthread_attr_setinheritsched( &attr, inheritsched );
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
#error "RTEMS is supposed to have pthread_attr_getinheritsched"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
#error "RTEMS is supposed to have pthread_attr_setschedpolicy"
|
||||
#endif
|
||||
@@ -30,6 +30,6 @@ void test( void )
|
||||
#ifdef _POSIX_SPORADIC_SERVER
|
||||
policy = SCHED_SPORADIC;
|
||||
#endif
|
||||
|
||||
|
||||
result = pthread_attr_setschedpolicy( &attr, policy );
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
#error "RTEMS is supposed to have pthread_attr_getschedpolicy"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
#error "RTEMS is supposed to have pthread_attr_setschedparam"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
#error "RTEMS is supposed to have pthread_attr_getschedparam"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_detach"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
#error "RTEMS is supposed to have pthread_setschedparam"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
#error "RTEMS is supposed to have pthread_getschedparam"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_join"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_once"
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#error "rtems is supposed to have pthread_cancel"
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user