forked from Imagelibrary/rtems
Remove stray white spaces.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
COPYRIGHT (c) 1997
|
||||
Objective Design Systems Ltd Pty (ODS)
|
||||
All rights reserved (R) Objective Design Systems Ltd Pty
|
||||
|
||||
|
||||
The license and distribution terms for this file may be found in the
|
||||
file LICENSE in this distribution or at
|
||||
http://www.rtems.com/license/LICENSE.
|
||||
@@ -34,12 +34,12 @@ class rtemsEvent
|
||||
{
|
||||
public:
|
||||
// attribute a task can have
|
||||
|
||||
|
||||
enum WaitMode { wait = RTEMS_WAIT,
|
||||
no_wait = RTEMS_NO_WAIT};
|
||||
enum Condition { any = RTEMS_EVENT_ANY,
|
||||
all = RTEMS_EVENT_ALL};
|
||||
|
||||
|
||||
// only the first 4 characters of the name are taken
|
||||
|
||||
// connect to a task
|
||||
@@ -48,14 +48,14 @@ public:
|
||||
// copy and default constructors
|
||||
rtemsEvent(const rtemsEvent& event);
|
||||
rtemsEvent();
|
||||
|
||||
|
||||
virtual ~rtemsEvent();
|
||||
|
||||
|
||||
// connect to an existing task object, will not be the owner
|
||||
const rtemsEvent& operator=(const rtemsEvent& event);
|
||||
virtual const rtems_status_code connect(const char *name,
|
||||
const rtems_unsigned32 node = RTEMS_SEARCH_ALL_NODES);
|
||||
|
||||
|
||||
// send an event
|
||||
inline const rtems_status_code send(const rtems_id task,
|
||||
const rtems_event_set events);
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
// object id, and name
|
||||
const rtems_id task_id_is() const { return id; }
|
||||
const rtems_name task_name_is() const { return name; }
|
||||
|
||||
|
||||
private:
|
||||
// task name
|
||||
rtems_name name;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
COPYRIGHT (c) 1997
|
||||
Objective Design Systems Ltd Pty (ODS)
|
||||
All rights reserved (R) Objective Design Systems Ltd Pty
|
||||
|
||||
|
||||
The license and distribution terms for this file may be found in the
|
||||
file LICENSE in this distribution or at
|
||||
http://www.rtems.com/license/LICENSE.
|
||||
@@ -29,11 +29,11 @@
|
||||
the old handler is not an instance of this class the chain is passed
|
||||
as "void (*)(void)". If it is an instance of this class, the handler
|
||||
method is directly called.
|
||||
|
||||
|
||||
The isr catch extends the documented return codes with :
|
||||
|
||||
RTEMS_RESOURCE_IN_USE = interrupt already caught
|
||||
|
||||
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
#if !defined(_rtemsInterrupt_h_)
|
||||
@@ -54,13 +54,13 @@ public:
|
||||
|
||||
// catch the interrupt
|
||||
virtual const rtems_status_code isr_catch(const rtems_vector_number vector);
|
||||
|
||||
|
||||
// release the interrupt back to the previous handle
|
||||
virtual const rtems_status_code release();
|
||||
|
||||
// the old handler
|
||||
const rtems_isr_entry old_isr_handler() const { return old_handler; }
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// called after the interrupt is caught and it goes off
|
||||
@@ -68,17 +68,17 @@ protected:
|
||||
|
||||
// chain to the previous handler,
|
||||
inline void chain() const;
|
||||
|
||||
|
||||
private:
|
||||
const rtemsInterrupt& operator=(const rtemsInterrupt& );
|
||||
rtemsInterrupt(const rtemsInterrupt& );
|
||||
|
||||
|
||||
// the vector caught
|
||||
rtems_vector_number vector;
|
||||
|
||||
|
||||
// true when the interrupt is caught
|
||||
bool caught;
|
||||
|
||||
|
||||
// returned when catching the interrupt
|
||||
rtems_isr_entry old_handler;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
COPYRIGHT (c) 1997
|
||||
Objective Design Systems Ltd Pty (ODS)
|
||||
All rights reserved (R) Objective Design Systems Ltd Pty
|
||||
|
||||
|
||||
The license and distribution terms for this file may be found in the
|
||||
file LICENSE in this distribution or at
|
||||
http://www.rtems.com/license/LICENSE.
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
The fourth constructor allows for the message queue to be created
|
||||
after construction, or to connect to a message queue later.
|
||||
|
||||
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
#if !defined(_rtemsMessageQueue_h_)
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
wait_by_priority = RTEMS_PRIORITY };
|
||||
enum Scope { local = RTEMS_LOCAL,
|
||||
global = RTEMS_GLOBAL };
|
||||
|
||||
|
||||
// only the first 4 characters of the name are taken
|
||||
|
||||
// creates a message queue
|
||||
@@ -70,10 +70,10 @@ public:
|
||||
// copy and default constructors
|
||||
rtemsMessageQueue(const rtemsMessageQueue& message_queue);
|
||||
rtemsMessageQueue();
|
||||
|
||||
|
||||
// only the creator's destructor will delete the actual object
|
||||
virtual ~rtemsMessageQueue();
|
||||
|
||||
|
||||
// create or destroy (delete) the message queue
|
||||
virtual const rtems_status_code create(const char* name,
|
||||
const rtems_unsigned32 count,
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
const rtemsMessageQueue& operator=(const rtemsMessageQueue& message_queue);
|
||||
virtual const rtems_status_code connect(const char *name,
|
||||
const rtems_unsigned32 node = RTEMS_SEARCH_ALL_NODES);
|
||||
|
||||
|
||||
// send a message of size from the buffer
|
||||
inline const rtems_status_code send(const void *buffer,
|
||||
const rtems_unsigned32 size);
|
||||
@@ -101,28 +101,28 @@ public:
|
||||
rtems_unsigned32& size,
|
||||
rtems_interval micro_secs = RTEMS_NO_TIMEOUT,
|
||||
bool wait = true);
|
||||
|
||||
|
||||
// flush a message queue, returning the number of messages dropped
|
||||
inline const rtems_status_code flush(rtems_unsigned32& size);
|
||||
|
||||
|
||||
// object id, and name
|
||||
const rtems_id id_is() const { return id; }
|
||||
const rtems_name name_is() const { return name; }
|
||||
const char *name_string() const { return name_str; }
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// make this object reference an invalid RTEMS object
|
||||
void make_invalid();
|
||||
|
||||
|
||||
// message queue name
|
||||
rtems_name name;
|
||||
char name_str[5];
|
||||
|
||||
|
||||
// owner, true if this object owns the message queue
|
||||
// will delete the message queue when it destructs
|
||||
bool owner;
|
||||
|
||||
|
||||
// the rtems id, object handle
|
||||
rtems_id id;
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
COPYRIGHT (c) 1997
|
||||
Objective Design Systems Ltd Pty (ODS)
|
||||
All rights reserved (R) Objective Design Systems Ltd Pty
|
||||
|
||||
|
||||
The license and distribution terms for this file may be found in the
|
||||
file LICENSE in this distribution or at
|
||||
http://www.rtems.com/license/LICENSE.
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
|
||||
// connect to an existing semaphore object by name
|
||||
rtemsSemaphore(const char *name, const rtems_unsigned32 node);
|
||||
|
||||
|
||||
// attach this object to an other objects semaphore
|
||||
rtemsSemaphore(const rtemsSemaphore& semaphore);
|
||||
rtemsSemaphore();
|
||||
@@ -91,28 +91,28 @@ public:
|
||||
const Ceiling ceiling = no_priority_ceiling,
|
||||
const rtems_task_priority priority_ceiling = 0);
|
||||
virtual const rtems_status_code destroy();
|
||||
|
||||
|
||||
// connect to an existing semaphore object, will not be the owner
|
||||
const rtemsSemaphore& operator=(const rtemsSemaphore& semaphore);
|
||||
virtual const rtems_status_code connect(const char *name, rtems_unsigned32 node);
|
||||
|
||||
|
||||
// obtain the semaphore, timeout is in micro-seconds
|
||||
inline const rtems_status_code obtain(bool wait = true,
|
||||
const rtems_unsigned32 micro_secs = RTEMS_NO_TIMEOUT);
|
||||
|
||||
|
||||
// release the semaphore, blocks threads eligble
|
||||
inline const rtems_status_code release();
|
||||
|
||||
|
||||
// object id, and name
|
||||
const rtems_id id_is() const { return id; }
|
||||
const rtems_name name_is() const { return name; }
|
||||
const char *name_string() const { return name_str; }
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// make the object reference no valid RTEMS object
|
||||
void make_invalid();
|
||||
|
||||
|
||||
// semaphore name
|
||||
rtems_name name;
|
||||
char name_str[5];
|
||||
@@ -120,7 +120,7 @@ private:
|
||||
// owner, true if this object owns the semaphore
|
||||
// will delete the semaphore when it destructs
|
||||
bool owner;
|
||||
|
||||
|
||||
// the rtems id, object handle
|
||||
rtems_id id;
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
COPYRIGHT (c) 1997
|
||||
Objective Design Systems Ltd Pty (ODS)
|
||||
All rights reserved (R) Objective Design Systems Ltd Pty
|
||||
|
||||
|
||||
The license and distribution terms for this file may be found in the
|
||||
file LICENSE in this distribution or at
|
||||
http://www.rtems.com/license/LICENSE.
|
||||
@@ -14,7 +14,7 @@
|
||||
------------------------------------------------------------------------
|
||||
|
||||
rtemsStatusCode controls and manages status codes from the RTEMS kernel.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@@ -30,15 +30,15 @@
|
||||
class rtemsStatusCode
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
rtemsStatusCode() { last_status = RTEMS_NOT_CONFIGURED; }
|
||||
|
||||
|
||||
const bool successful() { return last_status == RTEMS_SUCCESSFUL; }
|
||||
const bool unsuccessful() { return last_status != RTEMS_SUCCESSFUL; }
|
||||
|
||||
|
||||
// return the last status code
|
||||
const rtems_status_code last_status_code() { return last_status; }
|
||||
|
||||
|
||||
// return the last status as a string
|
||||
const char *last_status_string();
|
||||
|
||||
@@ -47,9 +47,9 @@ public:
|
||||
protected:
|
||||
const rtems_status_code set_status_code(const rtems_status_code status)
|
||||
{ return (last_status = status); }
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
// public at the moment, this might change
|
||||
rtems_status_code last_status;
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
COPYRIGHT (c) 1997
|
||||
Objective Design Systems Ltd Pty (ODS)
|
||||
All rights reserved (R) Objective Design Systems Ltd Pty
|
||||
|
||||
|
||||
The license and distribution terms for this file may be found in the
|
||||
file LICENSE in this distribution or at
|
||||
http://www.rtems.com/license/LICENSE.
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
The third constructor is a copy constructor. Connects to an existing
|
||||
object which is in scope.
|
||||
|
||||
|
||||
The RTEMS id is set to self in the default construction.
|
||||
|
||||
The creation of the task object can be defered until after
|
||||
@@ -50,7 +50,7 @@
|
||||
Mode control is through the rtemsTaskMode class.
|
||||
|
||||
The rtemsTask class reserved notepad register 31.
|
||||
|
||||
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
#if !defined(_rtemsTask_h_)
|
||||
@@ -90,10 +90,10 @@ public:
|
||||
// copy and default constructors
|
||||
rtemsTask(const rtemsTask& task);
|
||||
rtemsTask();
|
||||
|
||||
|
||||
// only the creator's destructor will delete the actual object
|
||||
virtual ~rtemsTask();
|
||||
|
||||
|
||||
// create or destroy (delete) the task
|
||||
virtual const rtems_status_code create(const char* name,
|
||||
const rtems_task_priority initial_priority,
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
const rtemsTask& operator=(const rtemsTask& task);
|
||||
virtual const rtems_status_code connect(const char *name,
|
||||
const rtems_unsigned32 node = RTEMS_SEARCH_ALL_NODES);
|
||||
|
||||
|
||||
// run control
|
||||
virtual const rtems_status_code start(const rtems_task_argument argument);
|
||||
virtual const rtems_status_code restart(const rtems_task_argument argument);
|
||||
@@ -120,13 +120,13 @@ public:
|
||||
// sleep control, the timeout is in micro-seconds
|
||||
virtual const rtems_status_code wake_after(const rtems_interval micro_secs);
|
||||
virtual const rtems_status_code wake_when(const rtems_time_of_day& tod);
|
||||
|
||||
|
||||
// priority control
|
||||
const rtems_status_code get_priority(rtems_task_priority& priority);
|
||||
const rtems_status_code set_priority(const rtems_task_priority priority);
|
||||
const rtems_status_code set_priority(const rtems_task_priority priority,
|
||||
rtems_task_priority& old_priority);
|
||||
|
||||
|
||||
// notepad control
|
||||
const rtems_status_code get_note(const rtems_unsigned32 notepad,
|
||||
rtems_unsigned32& note);
|
||||
@@ -137,17 +137,17 @@ public:
|
||||
const rtems_id id_is() const { return id; }
|
||||
const rtems_name name_is() const { return name; }
|
||||
const char *name_string() const { return name_str; }
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// task entry point
|
||||
virtual void body(rtems_task_argument argument);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// make the object to point to RTEMS_SELF
|
||||
void make_self();
|
||||
|
||||
|
||||
// task name
|
||||
rtems_name name;
|
||||
char name_str[5];
|
||||
@@ -155,14 +155,14 @@ private:
|
||||
// owner, true if this object owns the task
|
||||
// will delete the task when it destructs
|
||||
bool owner;
|
||||
|
||||
|
||||
// the rtems id, object handle
|
||||
rtems_id id;
|
||||
|
||||
// the argument for the task, this class uses the actual argument
|
||||
// passed to RTEMS
|
||||
rtems_task_argument argument;
|
||||
|
||||
|
||||
// common entry point to the task
|
||||
static rtems_task origin(rtems_task_argument argument);
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
COPYRIGHT (c) 1997
|
||||
Objective Design Systems Ltd Pty (ODS)
|
||||
All rights reserved (R) Objective Design Systems Ltd Pty
|
||||
|
||||
|
||||
The license and distribution terms for this file may be found in the
|
||||
file LICENSE in this distribution or at
|
||||
http://www.rtems.com/license/LICENSE.
|
||||
@@ -29,7 +29,7 @@
|
||||
Methods are provided for accessing and controlling a specific
|
||||
mode. The returned value will only contain the requested mode's flags,
|
||||
and only the that mode will be changed when setting a mode.
|
||||
|
||||
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
#if !defined(_rtemsTaskMode_h_)
|
||||
@@ -45,9 +45,9 @@ class rtemsTaskMode
|
||||
: public rtemsStatusCode
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
rtemsTaskMode() {};
|
||||
|
||||
|
||||
// group mode control, OR the values together
|
||||
inline const rtems_status_code get_mode(rtems_mode& mode);
|
||||
inline const rtems_status_code set_mode(const rtems_mode mode,
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
inline const rtems_status_code set_mode(const rtems_mode mode,
|
||||
const rtems_mode mask,
|
||||
rtems_mode& old_mode);
|
||||
|
||||
|
||||
// preemption control
|
||||
inline const rtems_status_code get_preemption_state(rtems_mode& preemption);
|
||||
inline const rtems_status_code set_preemption_state(const rtems_mode preemption);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
COPYRIGHT (c) 1997
|
||||
Objective Design Systems Ltd Pty (ODS)
|
||||
All rights reserved (R) Objective Design Systems Ltd Pty
|
||||
|
||||
|
||||
The license and distribution terms for this file may be found in the
|
||||
file LICENSE in this distribution or at
|
||||
http://www.rtems.com/license/LICENSE.
|
||||
@@ -22,7 +22,7 @@
|
||||
method.
|
||||
|
||||
Timers are always local to a node.
|
||||
|
||||
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
#if !defined(_rtemsTimer_h_)
|
||||
@@ -43,32 +43,32 @@ public:
|
||||
// create a timer object
|
||||
rtemsTimer(const char* name);
|
||||
rtemsTimer();
|
||||
|
||||
|
||||
// destroies the actual object
|
||||
virtual ~rtemsTimer();
|
||||
|
||||
// create or destroy (delete) the timer
|
||||
virtual const rtems_status_code create(const char* name);
|
||||
virtual const rtems_status_code destroy();
|
||||
|
||||
|
||||
// timer control
|
||||
inline const rtems_status_code fire_after(const rtems_interval micro_secs);
|
||||
inline const rtems_status_code repeat_fire_at(const rtems_interval micro_secs);
|
||||
inline const rtems_status_code fire_when(const rtems_time_of_day& when);
|
||||
|
||||
|
||||
inline const rtems_status_code cancel();
|
||||
inline const rtems_status_code reset();
|
||||
|
||||
|
||||
// object id, and name
|
||||
const rtems_id id_is() const { return id; }
|
||||
const rtems_name name_is() const { return name; }
|
||||
const char *name_string() const { return name_str; }
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// triggered method is called when the timer fires
|
||||
virtual void triggered() = 0;
|
||||
|
||||
|
||||
private:
|
||||
// not permitted
|
||||
rtemsTimer(const rtemsTimer& timer);
|
||||
@@ -76,7 +76,7 @@ private:
|
||||
|
||||
// make this object reference an invalid RTEMS object
|
||||
void make_invalid();
|
||||
|
||||
|
||||
// semaphore name
|
||||
rtems_name name;
|
||||
char name_str[5];
|
||||
|
||||
@@ -69,7 +69,7 @@ void TestCre()
|
||||
{
|
||||
ER status;
|
||||
T_CMBF pk_cmbf;
|
||||
|
||||
|
||||
/*
|
||||
* Exercise cre_mbf - this code seems to exercise every path.
|
||||
*/
|
||||
@@ -97,7 +97,7 @@ void TestCre()
|
||||
pk_cmbf.maxmsz = 101;
|
||||
status = cre_mbf( 1, &pk_cmbf );
|
||||
assert( status == E_PAR );
|
||||
|
||||
|
||||
/*
|
||||
* Now run through all the bad ID errors
|
||||
*/
|
||||
@@ -126,7 +126,7 @@ void TestCre()
|
||||
pk_cmbf.mbfatr = TA_TFIFO;
|
||||
status = cre_mbf( 1, &pk_cmbf );
|
||||
assert( status == E_OK );
|
||||
|
||||
|
||||
puts( "Init - cre_mbf - create mbf 1 again - E_OBJ" );
|
||||
status = cre_mbf( 1, &pk_cmbf );
|
||||
assert( status == E_OBJ );
|
||||
@@ -142,7 +142,7 @@ void TestCre()
|
||||
void TestDel()
|
||||
{
|
||||
ER status;
|
||||
|
||||
|
||||
/*
|
||||
* Generate all the bad id errors for del_mbf
|
||||
*/
|
||||
@@ -163,7 +163,7 @@ void TestDel()
|
||||
status = del_mbf( CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS + 1 );
|
||||
assert( status == E_ID );
|
||||
|
||||
|
||||
|
||||
puts("Init - del_mbf - E_OK" );
|
||||
status = del_mbf(2);
|
||||
assert(status == E_OK);
|
||||
@@ -173,7 +173,7 @@ void TestPsnd()
|
||||
{
|
||||
ER status;
|
||||
char msg[100] = "This is test message 1";
|
||||
|
||||
|
||||
/*
|
||||
* Generate all the bad id errors for psnd_mbf
|
||||
*/
|
||||
@@ -192,23 +192,23 @@ void TestPsnd()
|
||||
|
||||
puts( "Init - psnd_mbf - bad id (too great) - E_ID" );
|
||||
status = psnd_mbf(CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS + 1, msg,
|
||||
sizeof(msg));
|
||||
sizeof(msg));
|
||||
assert( status == E_ID );
|
||||
|
||||
puts( "Init - psnd_mbf - msg == 0, E_PAR" );
|
||||
status = psnd_mbf(1, 0, sizeof(msg));
|
||||
status = psnd_mbf(1, 0, sizeof(msg));
|
||||
assert( status == E_PAR );
|
||||
|
||||
puts( "Init - psnd_mbf - msgsz too big - E_PAR" );
|
||||
status = psnd_mbf(1, msg, 300);
|
||||
status = psnd_mbf(1, msg, 300);
|
||||
assert( status == E_PAR );
|
||||
|
||||
puts( "Init - psnd_mbf - msgsz <0 - E_PAR" );
|
||||
status = psnd_mbf(1, msg, -10);
|
||||
status = psnd_mbf(1, msg, -10);
|
||||
assert( status == E_PAR );
|
||||
|
||||
puts( "Init - psnd_mbf - E_OK" );
|
||||
status = psnd_mbf(1, msg, sizeof(msg));
|
||||
status = psnd_mbf(1, msg, sizeof(msg));
|
||||
assert( status == E_OK );
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ void TestRef()
|
||||
{
|
||||
ER status;
|
||||
T_RMBF pk_rmbf;
|
||||
|
||||
|
||||
puts( "Init - ref_mbf - bad id (less than -4) - E_OACV" );
|
||||
status = ref_mbf(&pk_rmbf, -5);
|
||||
assert( status == E_OACV );
|
||||
@@ -241,7 +241,7 @@ void TestRef()
|
||||
puts( "Init - ref_mbf - mbf 1 - E_OK" );
|
||||
status = ref_mbf( &pk_rmbf, 1 );
|
||||
assert( status == E_OK );
|
||||
|
||||
|
||||
printf( "Init - mbf 1 msgsz = %d\n", pk_rmbf.msgsz );
|
||||
printf( "Init - mbf 1 frbufsz = %d\n", pk_rmbf.frbufsz );
|
||||
printf( "Init - mbf 1 waiting tasks = %d\n", pk_rmbf.wtsk );
|
||||
@@ -342,7 +342,7 @@ void TestTrcv()
|
||||
puts( "Init - trcv_mbf - bad id (too great) - E_ID" );
|
||||
status = trcv_mbf(buffer, &s,
|
||||
CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS + 1,
|
||||
5000);
|
||||
5000);
|
||||
assert( status == E_ID );
|
||||
|
||||
puts( "Init - trcv_mbf - NULL msg returns E_PAR" );
|
||||
|
||||
@@ -152,8 +152,8 @@ void ITRON_Init( void )
|
||||
|
||||
puts( "Init - preq_sem - bad id (less than -4) - E_OACV" );
|
||||
status = preq_sem( -5 );
|
||||
assert( status == E_OACV );
|
||||
|
||||
assert( status == E_OACV );
|
||||
|
||||
puts( "Init - preq_sem - bad id (between 0 and -4) - E_ID" );
|
||||
status = preq_sem( -4 );
|
||||
assert( status == E_ID );
|
||||
@@ -256,7 +256,7 @@ void ITRON_Init( void )
|
||||
assert( status == E_TMOUT );
|
||||
|
||||
/*
|
||||
* Exercise twai_sem
|
||||
* Exercise twai_sem
|
||||
*/
|
||||
|
||||
puts( "Init - twai_sem - semaphore 1 unavailable - 1 second E_TMOUT" );
|
||||
|
||||
@@ -42,10 +42,10 @@ void ITRON_Init( void )
|
||||
|
||||
pk_ctsk.exinf = NULL;
|
||||
pk_ctsk.tskatr = TA_HLNG;
|
||||
pk_ctsk.itskpri = 1;
|
||||
pk_ctsk.itskpri = 1;
|
||||
pk_ctsk.task = Task_2_through_4;
|
||||
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE * 2;
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE * 2;
|
||||
status = cre_tsk( 2, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of TA1" );
|
||||
|
||||
@@ -53,7 +53,7 @@ void ITRON_Init( void )
|
||||
status = cre_tsk( 3, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of TA2" );
|
||||
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE * 3;
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE * 3;
|
||||
status = cre_tsk( 4, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of TA3" );
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ void Task_2_through_4()
|
||||
directive_failed( status, "get_tid");
|
||||
|
||||
tid_index = tid - 1; /* account for init tasks */
|
||||
|
||||
|
||||
sprintf(name, "TA%d", tid_index);
|
||||
|
||||
while( FOREVER ) {
|
||||
|
||||
@@ -32,48 +32,48 @@ void ITRON_Init( void )
|
||||
* Status Codes for these errors
|
||||
*
|
||||
*
|
||||
* E_OK - Normal Completion
|
||||
* E_OK - Normal Completion
|
||||
*
|
||||
* E_NOMEM - Insufficient memory (Memory for control block and/or user
|
||||
* stack cannot be allocated)
|
||||
* stack cannot be allocated)
|
||||
*
|
||||
* E_ID - Invalid ID Number (tskid was invalid or could not be used)
|
||||
* E_ID - Invalid ID Number (tskid was invalid or could not be used)
|
||||
*
|
||||
* E_RSATR - Reserved attribute (tskatr was invalid or could not be used)
|
||||
* E_RSATR - Reserved attribute (tskatr was invalid or could not be used)
|
||||
*
|
||||
* E_OBJ - Invalid object state (a task of the same ID already exists)
|
||||
* E_OBJ - Invalid object state (a task of the same ID already exists)
|
||||
*
|
||||
* E_OACV - Object access violation (A tskid less than -4 was specified
|
||||
* from a user task. This is implementation dependent.)
|
||||
* E_OACV - Object access violation (A tskid less than -4 was specified
|
||||
* from a user task. This is implementation dependent.)
|
||||
*
|
||||
* E_PAR - Parameter error (pk_ctsk, task, itskpri and/or stksz is invalid)
|
||||
* E_PAR - Parameter error (pk_ctsk, task, itskpri and/or stksz is invalid)
|
||||
*
|
||||
* E_NOEXS - Object does not exist (the task specified by tskid does not
|
||||
* exist)
|
||||
* exist)
|
||||
*
|
||||
* E_CTX - Context error (issued from task-independent portions or a task
|
||||
* in dispatch disabled state)
|
||||
* E_CTX - Context error (issued from task-independent portions or a task
|
||||
* in dispatch disabled state)
|
||||
*
|
||||
*
|
||||
*
|
||||
* Network Specific Errors (ITRON calls these Connection Function Errors)
|
||||
*
|
||||
* EN_OBJNO - An object number which could not be accessed on the target
|
||||
* node is specified.
|
||||
* node is specified.
|
||||
*
|
||||
* EN_CTXID - Specified an object on another node when the system call
|
||||
* was issued from a task in dispatch disabled state or from
|
||||
* a task-independent portion
|
||||
* a task-independent portion
|
||||
*
|
||||
* EN_PAR - A value outside the range supported by the target node and/or
|
||||
* EN_PAR - A value outside the range supported by the target node and/or
|
||||
* transmission packet format was specified as a parameter
|
||||
* (a value outside supported range was specified for exinf,
|
||||
* tskatr, task, itskpri and/or stksz)
|
||||
* tskatr, task, itskpri and/or stksz)
|
||||
*
|
||||
* EN_RPAR - A value outside the range supported by the requesting node
|
||||
* and/or transmission packet format was returned as a return
|
||||
* EN_RPAR - A value outside the range supported by the requesting node
|
||||
* and/or transmission packet format was returned as a return
|
||||
* parameter (a value outside supported range was returned for
|
||||
* exinf, tskpri and/or tskstat)
|
||||
* exinf, tskpri and/or tskstat)
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -81,7 +81,7 @@ void ITRON_Init( void )
|
||||
rtems_time_of_day time;
|
||||
ER status;
|
||||
T_CTSK pk_ctsk;
|
||||
T_RTSK pk_rtsk; /* Reference Task Packet */
|
||||
T_RTSK pk_rtsk; /* Reference Task Packet */
|
||||
|
||||
|
||||
puts( "\n\n*** ITRON TASK TEST 2 ***\n" );
|
||||
@@ -95,13 +95,13 @@ void ITRON_Init( void )
|
||||
* Set My priority to 8 so that dummy tasks will be
|
||||
* forced to run when started.
|
||||
*/
|
||||
|
||||
|
||||
status = chg_pri( TSK_SELF, 8 );
|
||||
fatal_directive_status( status, E_OK, "chg_pri of TSK_SELF");
|
||||
status = ref_tsk( &pk_rtsk, TSK_SELF );
|
||||
fatal_directive_status( status, E_OK, "ref_tsk of TSK_SELF");
|
||||
fatal_directive_status( pk_rtsk.tskpri, 8, "task priority of SELF");
|
||||
|
||||
|
||||
/*
|
||||
* Create and verify a DORMANT task.
|
||||
*/
|
||||
@@ -110,7 +110,7 @@ void ITRON_Init( void )
|
||||
pk_ctsk.tskatr = TA_HLNG;
|
||||
pk_ctsk.itskpri = 1;
|
||||
pk_ctsk.task = Dormant_task;
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE;
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE;
|
||||
|
||||
puts( "Init - cre_tsk - Dormant Task" );
|
||||
status = cre_tsk( DORMANT_TASK_ID, &pk_ctsk );
|
||||
@@ -122,7 +122,7 @@ void ITRON_Init( void )
|
||||
/*
|
||||
* Create, Start and verify a not DORMANT task.
|
||||
*/
|
||||
|
||||
|
||||
pk_ctsk.task = Non_Dormant_task;
|
||||
puts( "Init - cre_tsk - Non-Dormant Task" );
|
||||
status = cre_tsk( NON_DORMANT_TASK_ID, &pk_ctsk );
|
||||
@@ -131,8 +131,8 @@ void ITRON_Init( void )
|
||||
status = ref_tsk( &pk_rtsk, NON_DORMANT_TASK_ID );
|
||||
fatal_directive_status( status, E_OK, "ref_tsk of NON_DORMANT");
|
||||
fatal_directive_status( pk_rtsk.tskstat,TTS_WAI,"task state of NON_DORMANT");
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Bad ID errors
|
||||
*/
|
||||
@@ -199,15 +199,15 @@ void ITRON_Init( void )
|
||||
|
||||
puts( "\n\n*** Delete Task Errors ***" );
|
||||
|
||||
/*
|
||||
/*
|
||||
* Reset structure
|
||||
*/
|
||||
|
||||
pk_ctsk.exinf = NULL;
|
||||
pk_ctsk.tskatr = TA_HLNG;
|
||||
pk_ctsk.itskpri = 1;
|
||||
pk_ctsk.itskpri = 1;
|
||||
pk_ctsk.task = Dormant_task;
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE;
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE;
|
||||
|
||||
|
||||
puts( "Init - del_tsk - cannot delete TSK_SELF - E_OBJ" );
|
||||
@@ -362,7 +362,7 @@ void ITRON_Init( void )
|
||||
* to handle this - addr=0x80002098 nr_bytes=0x4 processor=0x40134008
|
||||
* cia=0xc744"
|
||||
*/
|
||||
|
||||
|
||||
puts( "\n\n*** Rotate Ready Queue Errors ***" );
|
||||
puts( "Init - rot_rdq - priority -1 - E_PAR" );
|
||||
status = rot_rdq( -1 );
|
||||
@@ -407,7 +407,7 @@ void ITRON_Init( void )
|
||||
status = ref_tsk( &pk_rtsk, -2 );
|
||||
fatal_directive_status( status, E_ID, "ref_tsk -2");
|
||||
|
||||
/* XXX Call from task independent portion to cause E_ID
|
||||
/* XXX Call from task independent portion to cause E_ID
|
||||
puts( "Init - ref_tsk - reference INTERRUPT - E_ID" );
|
||||
status = ref_tsk( &pk_rtsk, TSK_SELF );
|
||||
assert( status == E_ID );
|
||||
|
||||
@@ -33,8 +33,8 @@ void ITRON_Init( void )
|
||||
|
||||
pk_ctsk.exinf = NULL;
|
||||
pk_ctsk.tskatr = TA_HLNG;
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE;
|
||||
pk_ctsk.itskpri = PREEMPT_PRIORITY;
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE;
|
||||
pk_ctsk.itskpri = PREEMPT_PRIORITY;
|
||||
pk_ctsk.task = Preempt_task;
|
||||
|
||||
puts( "\n\n*** ITRON TASK TEST 3 ***" );
|
||||
@@ -47,7 +47,7 @@ void ITRON_Init( void )
|
||||
puts( "INIT - Create and Start PREEMPT" );
|
||||
status = chg_pri( TSK_SELF, (PREEMPT_PRIORITY+2) );
|
||||
directive_failed( status, "chg_pri of SELF" );
|
||||
|
||||
|
||||
status = cre_tsk( PREEMPT_TASK_ID, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of RTEMS_PREEMPT" );
|
||||
|
||||
@@ -61,7 +61,7 @@ void ITRON_Init( void )
|
||||
status = ref_tsk( &pk_rtsk, PREEMPT_TASK_ID );
|
||||
directive_failed( status, "INIT - ref_tsk of RTEMS_PREEMPT");
|
||||
fatal_directive_status(pk_rtsk.tskstat,TTS_DMT,"tskstat of PREEMPT");
|
||||
|
||||
|
||||
/*
|
||||
* Restart the Preempt Task.
|
||||
*/
|
||||
@@ -76,12 +76,12 @@ void ITRON_Init( void )
|
||||
fatal_directive_status( status, E_NOEXS, "tskstat of PREEMPT");
|
||||
status = chg_pri( TSK_SELF, PREEMPT_PRIORITY );
|
||||
directive_failed( status, "chg_pri of SELF" );
|
||||
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* XXX
|
||||
*/
|
||||
|
||||
pk_ctsk.itskpri = 3;
|
||||
|
||||
pk_ctsk.itskpri = 3;
|
||||
pk_ctsk.task = Task_1;
|
||||
status = cre_tsk( TA1_ID, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of TA1" );
|
||||
@@ -121,7 +121,7 @@ void ITRON_Init( void )
|
||||
status = ter_tsk( TA3_ID );
|
||||
directive_failed( status, "ter_tsk of TA3" );
|
||||
|
||||
pk_ctsk.itskpri = 1;
|
||||
pk_ctsk.itskpri = 1;
|
||||
pk_ctsk.task = Task_1;
|
||||
status = cre_tsk( TA1_ID, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of TA1 at priority 1" );
|
||||
|
||||
@@ -38,7 +38,7 @@ void Preempt_task()
|
||||
|
||||
if ( Preempt_task_Count == 0 ) {
|
||||
Preempt_task_Count ++;
|
||||
puts( "PREEMPT - chg_pri increment priority ");
|
||||
puts( "PREEMPT - chg_pri increment priority ");
|
||||
status = chg_pri( PREEMPT_TASK_ID, (PREEMPT_PRIORITY+1) );
|
||||
directive_failed( status, "chg_pri" );
|
||||
puts( "PREEMPT - ext_tsk - going to DORMANT state" );
|
||||
|
||||
@@ -36,8 +36,8 @@ void ITRON_Init( void )
|
||||
|
||||
pk_ctsk.exinf = NULL;
|
||||
pk_ctsk.tskatr = TA_HLNG;
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE;
|
||||
pk_ctsk.itskpri = 2;
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE;
|
||||
pk_ctsk.itskpri = 2;
|
||||
|
||||
pk_ctsk.task = Task_1;
|
||||
status = cre_tsk( TA1_ID, &pk_ctsk );
|
||||
@@ -47,7 +47,7 @@ void ITRON_Init( void )
|
||||
status = cre_tsk( TA2_ID, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of TA2" );
|
||||
|
||||
pk_ctsk.itskpri = 1;
|
||||
pk_ctsk.itskpri = 1;
|
||||
pk_ctsk.task = Task_3;
|
||||
status = cre_tsk( TA3_ID, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of TA3" );
|
||||
@@ -57,7 +57,7 @@ void ITRON_Init( void )
|
||||
|
||||
/* dispatching disabled */
|
||||
|
||||
directive_failed_with_level( status, "dis_dsp from ITRON_Init", 1 );
|
||||
directive_failed_with_level( status, "dis_dsp from ITRON_Init", 1 );
|
||||
status = sta_tsk( TA1_ID, 0 );
|
||||
directive_failed_with_level( status, "sta_tsk of TA1", 1 );
|
||||
status = sta_tsk( TA2_ID, 0 );
|
||||
|
||||
@@ -29,7 +29,7 @@ void Task_3()
|
||||
puts("TA3 - frsm_tsk TA1");
|
||||
status = frsm_tsk( TA1_ID );
|
||||
directive_failed( status, "TA3 - frsm_tsk TA1" );
|
||||
|
||||
|
||||
puts("TA3 - rsm_tsk TA2");
|
||||
status = rsm_tsk( TA2_ID );
|
||||
directive_failed( status, "TA3 - rsm_tsk TA2" );
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
|
||||
/*
|
||||
* get the current time in second since epoch (1970), change it since 1985,
|
||||
* compute the time in millisecond
|
||||
* compute the time in millisecond
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
int time_sec_epoch( void ) {
|
||||
|
||||
int s_time,t_time,r_time;
|
||||
@@ -47,7 +47,7 @@ printf( "Time from 1985: %d\n", r_time );
|
||||
printf("milliseconds: %ld\n",m_sec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user