forked from Imagelibrary/rtems
2002-01-04 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* src/clockgetres.c: Apply rtems_set_errno_and_return_minus_one. * src/clockgettime.c: Apply rtems_set_errno_and_return_minus_one. * src/clocksettime.c: Apply rtems_set_errno_and_return_minus_one. * src/killinfo.c: Apply rtems_set_errno_and_return_minus_one. * src/mqueueclose.c: Apply rtems_set_errno_and_return_minus_one. * src/mqueuecreatesupp.c: Apply rtems_set_errno_and_return_minus_one. * src/mqueuegetattr.c: Apply rtems_set_errno_and_return_minus_one. * src/mqueuenotify.c: Apply rtems_set_errno_and_return_minus_one. * src/mqueueopen.c: Apply rtems_set_errno_and_return_minus_one. * src/mqueuerecvsupp.c: Apply rtems_set_errno_and_return_minus_one. * src/mqueuesendsupp.c: Apply rtems_set_errno_and_return_minus_one. * src/mqueuesetattr.c: Apply rtems_set_errno_and_return_minus_one. * src/mqueueunlink.c: Apply rtems_set_errno_and_return_minus_one. * src/nanosleep.c: Apply rtems_set_errno_and_return_minus_one. * src/pthreadkill.c: Apply rtems_set_errno_and_return_minus_one. * src/pthreadsigmask.c: Apply rtems_set_errno_and_return_minus_one. * src/ptimer1.c: Apply rtems_set_errno_and_return_minus_one. * src/sched.c: Apply rtems_set_errno_and_return_minus_one. * src/semaphorecreatesupp.c: Apply rtems_set_errno_and_return_minus_one. * src/semaphorewaitsupp.c: Apply rtems_set_errno_and_return_minus_one. * src/semclose.c: Apply rtems_set_errno_and_return_minus_one. * src/semdestroy.c: Apply rtems_set_errno_and_return_minus_one. * src/semgetvalue.c: Apply rtems_set_errno_and_return_minus_one. * src/seminit.c: Apply rtems_set_errno_and_return_minus_one. * src/semopen.c: Apply rtems_set_errno_and_return_minus_one. * src/sempost.c: Apply rtems_set_errno_and_return_minus_one. * src/semunlink.c: Apply rtems_set_errno_and_return_minus_one. * src/setpgid.c: Apply rtems_set_errno_and_return_minus_one. * src/setsid.c: Apply rtems_set_errno_and_return_minus_one. * src/sigaction.c: Apply rtems_set_errno_and_return_minus_one. * src/sigaddset.c: Apply rtems_set_errno_and_return_minus_one. * src/sigdelset.c: Apply rtems_set_errno_and_return_minus_one. * src/sigemptyset.c: Apply rtems_set_errno_and_return_minus_one. * src/sigfillset.c: Apply rtems_set_errno_and_return_minus_one. * src/sigismember.c: Apply rtems_set_errno_and_return_minus_one. * src/sigpending.c: Apply rtems_set_errno_and_return_minus_one. * src/sigtimedwait.c: Apply rtems_set_errno_and_return_minus_one. * src/utsname.c: Apply rtems_set_errno_and_return_minus_one.
This commit is contained in:
@@ -37,7 +37,7 @@ int uname(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !name )
|
if ( !name )
|
||||||
set_errno_and_return_minus_one( EFAULT );
|
rtems_set_errno_and_return_minus_one( EFAULT );
|
||||||
|
|
||||||
strcpy( name->sysname, "RTEMS" );
|
strcpy( name->sysname, "RTEMS" );
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ int clock_getres(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( !res )
|
if ( !res )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
switch ( clock_id ) {
|
switch ( clock_id ) {
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ int clock_getres(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ int clock_gettime(
|
|||||||
long ticks;
|
long ticks;
|
||||||
|
|
||||||
if ( !tp )
|
if ( !tp )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
switch ( clock_id ) {
|
switch ( clock_id ) {
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ int clock_gettime(
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ int clock_settime(
|
|||||||
_TOD_Microseconds_per_tick;
|
_TOD_Microseconds_per_tick;
|
||||||
|
|
||||||
if ( !_TOD_Validate( &tod ) )
|
if ( !_TOD_Validate( &tod ) )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We can't use the tp->tv_sec field because it is based on
|
* We can't use the tp->tv_sec field because it is based on
|
||||||
@@ -81,7 +81,7 @@ int clock_settime(
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -63,14 +63,14 @@ int killinfo(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ( pid != getpid() )
|
if ( pid != getpid() )
|
||||||
set_errno_and_return_minus_one( ESRCH );
|
rtems_set_errno_and_return_minus_one( ESRCH );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validate the signal passed if not 0.
|
* Validate the signal passed if not 0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( sig && !is_valid_signo(sig) ) {
|
if ( sig && !is_valid_signo(sig) ) {
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -320,7 +320,7 @@ post_process_signal:
|
|||||||
psiginfo = (POSIX_signals_Siginfo_node *)
|
psiginfo = (POSIX_signals_Siginfo_node *)
|
||||||
_Chain_Get( &_POSIX_signals_Inactive_siginfo );
|
_Chain_Get( &_POSIX_signals_Inactive_siginfo );
|
||||||
if ( !psiginfo ) {
|
if ( !psiginfo ) {
|
||||||
set_errno_and_return_minus_one( EAGAIN );
|
rtems_set_errno_and_return_minus_one( EAGAIN );
|
||||||
}
|
}
|
||||||
|
|
||||||
psiginfo->Info = *siginfo;
|
psiginfo->Info = *siginfo;
|
||||||
|
|||||||
@@ -47,11 +47,11 @@ int mq_close(
|
|||||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EBADF );
|
rtems_set_errno_and_return_minus_one( EBADF );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
the_mq->open_count -= 1;
|
the_mq->open_count -= 1;
|
||||||
_POSIX_Message_queue_Delete( the_mq );
|
_POSIX_Message_queue_Delete( the_mq );
|
||||||
|
|||||||
@@ -67,12 +67,12 @@ int _POSIX_Message_queue_Create_support(
|
|||||||
} else {
|
} else {
|
||||||
if ( attr_ptr->mq_maxmsg < 0 ){
|
if ( attr_ptr->mq_maxmsg < 0 ){
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( attr_ptr->mq_msgsize < 0 ){
|
if ( attr_ptr->mq_msgsize < 0 ){
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
attr = *attr_ptr;
|
attr = *attr_ptr;
|
||||||
@@ -84,14 +84,14 @@ int _POSIX_Message_queue_Create_support(
|
|||||||
the_mq->Object.id, FALSE ) ) ) {
|
the_mq->Object.id, FALSE ) ) ) {
|
||||||
_POSIX_Message_queue_Free( the_mq );
|
_POSIX_Message_queue_Free( the_mq );
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( ENFILE );
|
rtems_set_errno_and_return_minus_one( ENFILE );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
the_mq = _POSIX_Message_queue_Allocate();
|
the_mq = _POSIX_Message_queue_Allocate();
|
||||||
if ( !the_mq ) {
|
if ( !the_mq ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( ENFILE );
|
rtems_set_errno_and_return_minus_one( ENFILE );
|
||||||
}
|
}
|
||||||
|
|
||||||
the_mq->process_shared = pshared;
|
the_mq->process_shared = pshared;
|
||||||
@@ -130,7 +130,7 @@ int _POSIX_Message_queue_Create_support(
|
|||||||
|
|
||||||
_POSIX_Message_queue_Free( the_mq );
|
_POSIX_Message_queue_Free( the_mq );
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( ENOSPC );
|
rtems_set_errno_and_return_minus_one( ENOSPC );
|
||||||
}
|
}
|
||||||
|
|
||||||
_Objects_Open(
|
_Objects_Open(
|
||||||
|
|||||||
@@ -47,16 +47,16 @@ int mq_getattr(
|
|||||||
CORE_message_queue_Attributes *the_mq_attr;
|
CORE_message_queue_Attributes *the_mq_attr;
|
||||||
|
|
||||||
if ( !mqstat )
|
if ( !mqstat )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EBADF );
|
rtems_set_errno_and_return_minus_one( EBADF );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
/*
|
/*
|
||||||
* Return the old values.
|
* Return the old values.
|
||||||
|
|||||||
@@ -70,16 +70,16 @@ int mq_notify(
|
|||||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EBADF );
|
rtems_set_errno_and_return_minus_one( EBADF );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
if ( notification ) {
|
if ( notification ) {
|
||||||
if ( _CORE_message_queue_Is_notify_enabled( &the_mq->Message_queue ) ) {
|
if ( _CORE_message_queue_Is_notify_enabled( &the_mq->Message_queue ) ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( EBUSY );
|
rtems_set_errno_and_return_minus_one( EBUSY );
|
||||||
}
|
}
|
||||||
|
|
||||||
_CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL, NULL );
|
_CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL, NULL );
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ mqd_t mq_open(
|
|||||||
|
|
||||||
if ( !( status == ENOENT && (oflag & O_CREAT) ) ) {
|
if ( !( status == ENOENT && (oflag & O_CREAT) ) ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one_cast( status, mqd_t );
|
rtems_set_errno_and_return_minus_one_cast( status, mqd_t );
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { /* name -> ID translation succeeded */
|
} else { /* name -> ID translation succeeded */
|
||||||
@@ -91,7 +91,7 @@ mqd_t mq_open(
|
|||||||
|
|
||||||
if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
|
if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one_cast( EEXIST, mqd_t );
|
rtems_set_errno_and_return_minus_one_cast( EEXIST, mqd_t );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -55,20 +55,20 @@ ssize_t _POSIX_Message_queue_Receive_support(
|
|||||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EBADF );
|
rtems_set_errno_and_return_minus_one( EBADF );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
if ( (the_mq->oflag & O_ACCMODE) == O_WRONLY ) {
|
if ( (the_mq->oflag & O_ACCMODE) == O_WRONLY ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( EBADF );
|
rtems_set_errno_and_return_minus_one( EBADF );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( msg_len < the_mq->Message_queue.maximum_message_size ) {
|
if ( msg_len < the_mq->Message_queue.maximum_message_size ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( EMSGSIZE );
|
rtems_set_errno_and_return_minus_one( EMSGSIZE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -94,7 +94,7 @@ ssize_t _POSIX_Message_queue_Receive_support(
|
|||||||
if ( !_Thread_Executing->Wait.return_code )
|
if ( !_Thread_Executing->Wait.return_code )
|
||||||
return length_out;
|
return length_out;
|
||||||
|
|
||||||
set_errno_and_return_minus_one(
|
rtems_set_errno_and_return_minus_one(
|
||||||
_POSIX_Message_queue_Translate_core_message_queue_return_code(
|
_POSIX_Message_queue_Translate_core_message_queue_return_code(
|
||||||
_Thread_Executing->Wait.return_code
|
_Thread_Executing->Wait.return_code
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -56,23 +56,23 @@ int _POSIX_Message_queue_Send_support(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ( msg_prio > MQ_PRIO_MAX )
|
if ( msg_prio > MQ_PRIO_MAX )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||||
|
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EBADF );
|
rtems_set_errno_and_return_minus_one( EBADF );
|
||||||
|
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
if ( (the_mq->oflag & O_ACCMODE) == O_RDONLY ) {
|
if ( (the_mq->oflag & O_ACCMODE) == O_RDONLY ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( EBADF );
|
rtems_set_errno_and_return_minus_one( EBADF );
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_status = _CORE_message_queue_Submit(
|
msg_status = _CORE_message_queue_Submit(
|
||||||
@@ -105,7 +105,7 @@ int _POSIX_Message_queue_Send_support(
|
|||||||
if ( !msg_status )
|
if ( !msg_status )
|
||||||
return msg_status;
|
return msg_status;
|
||||||
|
|
||||||
set_errno_and_return_minus_one(
|
rtems_set_errno_and_return_minus_one(
|
||||||
_POSIX_Message_queue_Translate_core_message_queue_return_code(
|
_POSIX_Message_queue_Translate_core_message_queue_return_code(
|
||||||
msg_status
|
msg_status
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -49,16 +49,16 @@ int mq_setattr(
|
|||||||
CORE_message_queue_Attributes *the_mq_attr;
|
CORE_message_queue_Attributes *the_mq_attr;
|
||||||
|
|
||||||
if ( !mqstat )
|
if ( !mqstat )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EBADF );
|
rtems_set_errno_and_return_minus_one( EBADF );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
|
|
||||||
the_core_mq = &the_mq->Message_queue;
|
the_core_mq = &the_mq->Message_queue;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ int mq_unlink(
|
|||||||
status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id );
|
status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id );
|
||||||
if ( status != 0 ) {
|
if ( status != 0 ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( status );
|
rtems_set_errno_and_return_minus_one( status );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -59,7 +59,7 @@ int mq_unlink(
|
|||||||
|
|
||||||
if ( !_Objects_Is_local_id(the_mq_id) ) {
|
if ( !_Objects_Is_local_id(the_mq_id) ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
}
|
}
|
||||||
|
|
||||||
the_mq = (POSIX_Message_queue_Control *) _Objects_Get_local_object(
|
the_mq = (POSIX_Message_queue_Control *) _Objects_Get_local_object(
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ int nanosleep(
|
|||||||
struct timespec *the_rqtp;
|
struct timespec *the_rqtp;
|
||||||
|
|
||||||
if ( !rqtp )
|
if ( !rqtp )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
the_rqtp = (struct timespec *)rqtp;
|
the_rqtp = (struct timespec *)rqtp;
|
||||||
|
|
||||||
@@ -47,10 +47,10 @@ int nanosleep(
|
|||||||
the_rqtp->tv_sec = 0;
|
the_rqtp->tv_sec = 0;
|
||||||
|
|
||||||
if ( /* the_rqtp->tv_sec < 0 || */ the_rqtp->tv_nsec < 0 )
|
if ( /* the_rqtp->tv_sec < 0 || */ the_rqtp->tv_nsec < 0 )
|
||||||
set_errno_and_return_minus_one( EAGAIN );
|
rtems_set_errno_and_return_minus_one( EAGAIN );
|
||||||
|
|
||||||
if ( the_rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND )
|
if ( the_rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
ticks = _POSIX_Timespec_to_interval( the_rqtp );
|
ticks = _POSIX_Timespec_to_interval( the_rqtp );
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ int nanosleep(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ticks )
|
if ( ticks )
|
||||||
set_errno_and_return_minus_one( EINTR );
|
rtems_set_errno_and_return_minus_one( EINTR );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -35,18 +35,18 @@ int pthread_kill(
|
|||||||
Objects_Locations location;
|
Objects_Locations location;
|
||||||
|
|
||||||
if ( sig && !is_valid_signo(sig) )
|
if ( sig && !is_valid_signo(sig) )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
/* commented out when posix timers added
|
/* commented out when posix timers added
|
||||||
if ( _POSIX_signals_Vectors[ sig ].sa_flags == SA_SIGINFO )
|
if ( _POSIX_signals_Vectors[ sig ].sa_flags == SA_SIGINFO )
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
the_thread = _POSIX_Threads_Get( thread, &location );
|
the_thread = _POSIX_Threads_Get( thread, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
set_errno_and_return_minus_one( ESRCH );
|
rtems_set_errno_and_return_minus_one( ESRCH );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
/*
|
/*
|
||||||
* If sig == 0 then just validate arguments
|
* If sig == 0 then just validate arguments
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ int pthread_sigmask(
|
|||||||
POSIX_API_Control *api;
|
POSIX_API_Control *api;
|
||||||
|
|
||||||
if ( !set && !oset )
|
if ( !set && !oset )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ int pthread_sigmask(
|
|||||||
api->signals_blocked = *set;
|
api->signals_blocked = *set;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX are there critical section problems here? */
|
/* XXX are there critical section problems here? */
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ int timer_create(
|
|||||||
if ( ( evp->sigev_notify != SIGEV_NONE ) &&
|
if ( ( evp->sigev_notify != SIGEV_NONE ) &&
|
||||||
( evp->sigev_notify != SIGEV_SIGNAL ) ) {
|
( evp->sigev_notify != SIGEV_SIGNAL ) ) {
|
||||||
/* The value of the field sigev_notify is not valid */
|
/* The value of the field sigev_notify is not valid */
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,7 +306,7 @@ int timer_create(
|
|||||||
/* There is not position for another timers in spite of RTEMS
|
/* There is not position for another timers in spite of RTEMS
|
||||||
* supports it. It will necessaty to increase the structure used */
|
* supports it. It will necessaty to increase the structure used */
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EAGAIN );
|
rtems_set_errno_and_return_minus_one( EAGAIN );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Exit parameter */
|
/* Exit parameter */
|
||||||
@@ -338,12 +338,12 @@ int timer_create(
|
|||||||
|
|
||||||
case RTEMS_INVALID_NAME : /* The assigned name is not valid */
|
case RTEMS_INVALID_NAME : /* The assigned name is not valid */
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
case RTEMS_TOO_MANY :
|
case RTEMS_TOO_MANY :
|
||||||
|
|
||||||
/* There has been created too much timers for the same process */
|
/* There has been created too much timers for the same process */
|
||||||
set_errno_and_return_minus_one( EAGAIN );
|
rtems_set_errno_and_return_minus_one( EAGAIN );
|
||||||
|
|
||||||
default :
|
default :
|
||||||
|
|
||||||
@@ -353,14 +353,14 @@ int timer_create(
|
|||||||
* rtems_timer_create can not return other different value.
|
* rtems_timer_create can not return other different value.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The next sentence is used to avoid singular situations
|
* The next sentence is used to avoid singular situations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -391,7 +391,7 @@ int timer_delete(
|
|||||||
|
|
||||||
if ( timer_pos == BAD_TIMER_C ) {
|
if ( timer_pos == BAD_TIMER_C ) {
|
||||||
/* The timer identifier is erroneus */
|
/* The timer identifier is erroneus */
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The timer is deleted */
|
/* The timer is deleted */
|
||||||
@@ -400,7 +400,7 @@ int timer_delete(
|
|||||||
|
|
||||||
if ( status == RTEMS_INVALID_ID ) {
|
if ( status == RTEMS_INVALID_ID ) {
|
||||||
/* The timer identifier is erroneus */
|
/* The timer identifier is erroneus */
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initializes the data of the timer */
|
/* Initializes the data of the timer */
|
||||||
@@ -437,14 +437,14 @@ int timer_settime(
|
|||||||
|
|
||||||
if ( timer_pos == BAD_TIMER_C ) {
|
if ( timer_pos == BAD_TIMER_C ) {
|
||||||
/* The timer identifier is erroneus */
|
/* The timer identifier is erroneus */
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( value == NULL ) {
|
if ( value == NULL ) {
|
||||||
/* The stucture of times of the timer is free, and then returns an
|
/* The stucture of times of the timer is free, and then returns an
|
||||||
error but the variable errno is not actualized */
|
error but the variable errno is not actualized */
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the function reaches this point, then it will be necessary to do
|
/* If the function reaches this point, then it will be necessary to do
|
||||||
@@ -487,7 +487,7 @@ int timer_settime(
|
|||||||
( value->it_value.tv_nsec < MIN_NSEC_C ) ) {
|
( value->it_value.tv_nsec < MIN_NSEC_C ) ) {
|
||||||
/* The number of nanoseconds is not correct */
|
/* The number of nanoseconds is not correct */
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Then, "value" must be converted from seconds and nanoseconds to clock
|
/* Then, "value" must be converted from seconds and nanoseconds to clock
|
||||||
@@ -610,7 +610,7 @@ int timer_settime(
|
|||||||
/* The timer identifier is not correct. In theory, this
|
/* The timer identifier is not correct. In theory, this
|
||||||
* situation can not occur, but the solution is easy */
|
* situation can not occur, but the solution is easy */
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -625,7 +625,7 @@ int timer_settime(
|
|||||||
* errno = EINVAL;
|
* errno = EINVAL;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
@@ -687,7 +687,7 @@ int timer_gettime(
|
|||||||
|
|
||||||
if ( timer_pos == BAD_TIMER_C ) {
|
if ( timer_pos == BAD_TIMER_C ) {
|
||||||
/* The timer identifier is erroneus */
|
/* The timer identifier is erroneus */
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculates the difference between the start time of the timer and
|
/* Calculates the difference between the start time of the timer and
|
||||||
@@ -774,7 +774,7 @@ int timer_getoverrun(
|
|||||||
|
|
||||||
if ( timer_pos == BAD_TIMER_C ) {
|
if ( timer_pos == BAD_TIMER_C ) {
|
||||||
/* The timer identifier is erroneus */
|
/* The timer identifier is erroneus */
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The overflow count of the timer is stored in "overrun" */
|
/* The overflow count of the timer is stored in "overrun" */
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ int sched_setparam(
|
|||||||
const struct sched_param *param
|
const struct sched_param *param
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
@@ -41,7 +41,7 @@ int sched_getparam(
|
|||||||
const struct sched_param *param
|
const struct sched_param *param
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
@@ -56,7 +56,7 @@ int sched_setscheduler(
|
|||||||
const struct sched_param *param
|
const struct sched_param *param
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
@@ -68,7 +68,7 @@ int sched_getscheduler(
|
|||||||
pid_t pid
|
pid_t pid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
@@ -88,7 +88,7 @@ int sched_get_priority_max(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
return POSIX_SCHEDULER_MAXIMUM_PRIORITY;
|
return POSIX_SCHEDULER_MAXIMUM_PRIORITY;
|
||||||
@@ -111,7 +111,7 @@ int sched_get_priority_min(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
return POSIX_SCHEDULER_MINIMUM_PRIORITY;
|
return POSIX_SCHEDULER_MINIMUM_PRIORITY;
|
||||||
@@ -134,10 +134,10 @@ int sched_rr_get_interval(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ( pid && pid != getpid() )
|
if ( pid && pid != getpid() )
|
||||||
set_errno_and_return_minus_one( ESRCH );
|
rtems_set_errno_and_return_minus_one( ESRCH );
|
||||||
|
|
||||||
if ( !interval )
|
if ( !interval )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
_POSIX_Interval_to_timespec( _Thread_Ticks_per_timeslice, interval );
|
_POSIX_Interval_to_timespec( _Thread_Ticks_per_timeslice, interval );
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <string.h> /* strlen */
|
||||||
|
|
||||||
#include <rtems/system.h>
|
#include <rtems/system.h>
|
||||||
#include <rtems/score/object.h>
|
#include <rtems/score/object.h>
|
||||||
@@ -44,13 +45,13 @@ int _POSIX_Semaphore_Create_support(
|
|||||||
/* Sharing semaphores among processes is not currently supported */
|
/* Sharing semaphores among processes is not currently supported */
|
||||||
if (pshared != 0) {
|
if (pshared != 0) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( name ) {
|
if ( name ) {
|
||||||
if( strlen(name) > PATH_MAX ) {
|
if( strlen(name) > PATH_MAX ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( ENAMETOOLONG );
|
rtems_set_errno_and_return_minus_one( ENAMETOOLONG );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ int _POSIX_Semaphore_Create_support(
|
|||||||
|
|
||||||
if ( !the_semaphore ) {
|
if ( !the_semaphore ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( ENOSPC );
|
rtems_set_errno_and_return_minus_one( ENOSPC );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
@@ -67,7 +68,7 @@ int _POSIX_Semaphore_Create_support(
|
|||||||
the_semaphore->Object.id, FALSE ) ) ) {
|
the_semaphore->Object.id, FALSE ) ) ) {
|
||||||
_POSIX_Semaphore_Free( the_semaphore );
|
_POSIX_Semaphore_Free( the_semaphore );
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( EAGAIN );
|
rtems_set_errno_and_return_minus_one( EAGAIN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ int _POSIX_Semaphore_Wait_support(
|
|||||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
_CORE_semaphore_Seize(
|
_CORE_semaphore_Seize(
|
||||||
&the_semaphore->Semaphore,
|
&the_semaphore->Semaphore,
|
||||||
@@ -53,11 +53,11 @@ int _POSIX_Semaphore_Wait_support(
|
|||||||
case CORE_SEMAPHORE_STATUS_SUCCESSFUL:
|
case CORE_SEMAPHORE_STATUS_SUCCESSFUL:
|
||||||
break;
|
break;
|
||||||
case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT:
|
case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT:
|
||||||
set_errno_and_return_minus_one( EAGAIN );
|
rtems_set_errno_and_return_minus_one( EAGAIN );
|
||||||
case CORE_SEMAPHORE_WAS_DELETED:
|
case CORE_SEMAPHORE_WAS_DELETED:
|
||||||
set_errno_and_return_minus_one( EAGAIN );
|
rtems_set_errno_and_return_minus_one( EAGAIN );
|
||||||
case CORE_SEMAPHORE_TIMEOUT:
|
case CORE_SEMAPHORE_TIMEOUT:
|
||||||
set_errno_and_return_minus_one( ETIMEDOUT );
|
rtems_set_errno_and_return_minus_one( ETIMEDOUT );
|
||||||
break;
|
break;
|
||||||
case CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED:
|
case CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED:
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ int sem_close(
|
|||||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
the_semaphore->open_count -= 1;
|
the_semaphore->open_count -= 1;
|
||||||
_POSIX_Semaphore_Delete( the_semaphore );
|
_POSIX_Semaphore_Delete( the_semaphore );
|
||||||
|
|||||||
@@ -35,11 +35,11 @@ int sem_destroy(
|
|||||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
/*
|
/*
|
||||||
* Undefined operation on a named semaphore.
|
* Undefined operation on a named semaphore.
|
||||||
@@ -47,7 +47,7 @@ int sem_destroy(
|
|||||||
|
|
||||||
if ( the_semaphore->named == TRUE ) {
|
if ( the_semaphore->named == TRUE ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
_POSIX_Semaphore_Delete( the_semaphore );
|
_POSIX_Semaphore_Delete( the_semaphore );
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ int sem_getvalue(
|
|||||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
*sval = _CORE_semaphore_Get_count( &the_semaphore->Semaphore );
|
*sval = _CORE_semaphore_Get_count( &the_semaphore->Semaphore );
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ int sem_init(
|
|||||||
POSIX_Semaphore_Control *the_semaphore;
|
POSIX_Semaphore_Control *the_semaphore;
|
||||||
|
|
||||||
if ( !sem )
|
if ( !sem )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
status = _POSIX_Semaphore_Create_support(
|
status = _POSIX_Semaphore_Create_support(
|
||||||
NULL,
|
NULL,
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ sem_t *sem_open(
|
|||||||
|
|
||||||
if ( !( status == ENOENT && (oflag & O_CREAT) ) ) {
|
if ( !( status == ENOENT && (oflag & O_CREAT) ) ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one_cast( status, sem_t * );
|
rtems_set_errno_and_return_minus_one_cast( status, sem_t * );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ sem_t *sem_open(
|
|||||||
|
|
||||||
if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
|
if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one_cast( EEXIST, sem_t * );
|
rtems_set_errno_and_return_minus_one_cast( EEXIST, sem_t * );
|
||||||
}
|
}
|
||||||
|
|
||||||
the_semaphore = _POSIX_Semaphore_Get( &the_semaphore_id, &location );
|
the_semaphore = _POSIX_Semaphore_Get( &the_semaphore_id, &location );
|
||||||
|
|||||||
@@ -35,11 +35,11 @@ int sem_post(
|
|||||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
_CORE_semaphore_Surrender(
|
_CORE_semaphore_Surrender(
|
||||||
&the_semaphore->Semaphore,
|
&the_semaphore->Semaphore,
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ int sem_unlink(
|
|||||||
status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id );
|
status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id );
|
||||||
if ( status != 0 ) {
|
if ( status != 0 ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( status );
|
rtems_set_errno_and_return_minus_one( status );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -52,7 +52,7 @@ int sem_unlink(
|
|||||||
|
|
||||||
if ( !_Objects_Is_local_id(the_semaphore_id) ) {
|
if ( !_Objects_Is_local_id(the_semaphore_id) ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
}
|
}
|
||||||
|
|
||||||
the_semaphore = (POSIX_Semaphore_Control *) _Objects_Get_local_object(
|
the_semaphore = (POSIX_Semaphore_Control *) _Objects_Get_local_object(
|
||||||
|
|||||||
@@ -25,5 +25,5 @@ int setpgid(
|
|||||||
pid_t pgid
|
pid_t pgid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
pid_t setsid( void )
|
pid_t setsid( void )
|
||||||
{
|
{
|
||||||
set_errno_and_return_minus_one( EPERM );
|
rtems_set_errno_and_return_minus_one( EPERM );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ int sigaction(
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( !is_valid_signo(sig) )
|
if ( !is_valid_signo(sig) )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some signals cannot be ignored (P1003.1b-1993, pp. 70-72 and references.
|
* Some signals cannot be ignored (P1003.1b-1993, pp. 70-72 and references.
|
||||||
@@ -56,7 +56,7 @@ int sigaction(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ( sig == SIGKILL )
|
if ( sig == SIGKILL )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Evaluate the new action structure and set the global signal vector
|
* Evaluate the new action structure and set the global signal vector
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ int sigaddset(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( !set )
|
if ( !set )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
if ( !signo )
|
if ( !signo )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( !is_valid_signo(signo) )
|
if ( !is_valid_signo(signo) )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
*set |= signo_to_mask(signo);
|
*set |= signo_to_mask(signo);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -33,13 +33,13 @@ int sigdelset(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( !set )
|
if ( !set )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
if ( !signo )
|
if ( !signo )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( !is_valid_signo(signo) )
|
if ( !is_valid_signo(signo) )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
*set &= ~signo_to_mask(signo);
|
*set &= ~signo_to_mask(signo);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ int sigemptyset(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( !set )
|
if ( !set )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
*set = 0;
|
*set = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ int sigfillset(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( !set )
|
if ( !set )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
*set = SIGNAL_ALL_MASK;
|
*set = SIGNAL_ALL_MASK;
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ int sigismember(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( !set )
|
if ( !set )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
if ( !signo )
|
if ( !signo )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( !is_valid_signo(signo) )
|
if ( !is_valid_signo(signo) )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
if ( *set & signo_to_mask(signo) )
|
if ( *set & signo_to_mask(signo) )
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ int sigpending(
|
|||||||
POSIX_API_Control *api;
|
POSIX_API_Control *api;
|
||||||
|
|
||||||
if ( !set )
|
if ( !set )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ int sigtimedwait(
|
|||||||
|
|
||||||
if ( timeout->tv_nsec < 0 ||
|
if ( timeout->tv_nsec < 0 ||
|
||||||
timeout->tv_nsec >= TOD_NANOSECONDS_PER_SECOND) {
|
timeout->tv_nsec >= TOD_NANOSECONDS_PER_SECOND) {
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
interval = _POSIX_Timespec_to_interval( timeout );
|
interval = _POSIX_Timespec_to_interval( timeout );
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ int uname(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !name )
|
if ( !name )
|
||||||
set_errno_and_return_minus_one( EFAULT );
|
rtems_set_errno_and_return_minus_one( EFAULT );
|
||||||
|
|
||||||
strcpy( name->sysname, "RTEMS" );
|
strcpy( name->sysname, "RTEMS" );
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ int uname(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !name )
|
if ( !name )
|
||||||
set_errno_and_return_minus_one( EFAULT );
|
rtems_set_errno_and_return_minus_one( EFAULT );
|
||||||
|
|
||||||
strcpy( name->sysname, "RTEMS" );
|
strcpy( name->sysname, "RTEMS" );
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ int uname(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !name )
|
if ( !name )
|
||||||
set_errno_and_return_minus_one( EFAULT );
|
rtems_set_errno_and_return_minus_one( EFAULT );
|
||||||
|
|
||||||
strcpy( name->sysname, "RTEMS" );
|
strcpy( name->sysname, "RTEMS" );
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ int clock_getres(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( !res )
|
if ( !res )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
switch ( clock_id ) {
|
switch ( clock_id ) {
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ int clock_getres(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ int clock_gettime(
|
|||||||
long ticks;
|
long ticks;
|
||||||
|
|
||||||
if ( !tp )
|
if ( !tp )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
switch ( clock_id ) {
|
switch ( clock_id ) {
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ int clock_gettime(
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ int clock_settime(
|
|||||||
_TOD_Microseconds_per_tick;
|
_TOD_Microseconds_per_tick;
|
||||||
|
|
||||||
if ( !_TOD_Validate( &tod ) )
|
if ( !_TOD_Validate( &tod ) )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We can't use the tp->tv_sec field because it is based on
|
* We can't use the tp->tv_sec field because it is based on
|
||||||
@@ -81,7 +81,7 @@ int clock_settime(
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -63,14 +63,14 @@ int killinfo(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ( pid != getpid() )
|
if ( pid != getpid() )
|
||||||
set_errno_and_return_minus_one( ESRCH );
|
rtems_set_errno_and_return_minus_one( ESRCH );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validate the signal passed if not 0.
|
* Validate the signal passed if not 0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( sig && !is_valid_signo(sig) ) {
|
if ( sig && !is_valid_signo(sig) ) {
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -320,7 +320,7 @@ post_process_signal:
|
|||||||
psiginfo = (POSIX_signals_Siginfo_node *)
|
psiginfo = (POSIX_signals_Siginfo_node *)
|
||||||
_Chain_Get( &_POSIX_signals_Inactive_siginfo );
|
_Chain_Get( &_POSIX_signals_Inactive_siginfo );
|
||||||
if ( !psiginfo ) {
|
if ( !psiginfo ) {
|
||||||
set_errno_and_return_minus_one( EAGAIN );
|
rtems_set_errno_and_return_minus_one( EAGAIN );
|
||||||
}
|
}
|
||||||
|
|
||||||
psiginfo->Info = *siginfo;
|
psiginfo->Info = *siginfo;
|
||||||
|
|||||||
@@ -47,11 +47,11 @@ int mq_close(
|
|||||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EBADF );
|
rtems_set_errno_and_return_minus_one( EBADF );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
the_mq->open_count -= 1;
|
the_mq->open_count -= 1;
|
||||||
_POSIX_Message_queue_Delete( the_mq );
|
_POSIX_Message_queue_Delete( the_mq );
|
||||||
|
|||||||
@@ -67,12 +67,12 @@ int _POSIX_Message_queue_Create_support(
|
|||||||
} else {
|
} else {
|
||||||
if ( attr_ptr->mq_maxmsg < 0 ){
|
if ( attr_ptr->mq_maxmsg < 0 ){
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( attr_ptr->mq_msgsize < 0 ){
|
if ( attr_ptr->mq_msgsize < 0 ){
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
attr = *attr_ptr;
|
attr = *attr_ptr;
|
||||||
@@ -84,14 +84,14 @@ int _POSIX_Message_queue_Create_support(
|
|||||||
the_mq->Object.id, FALSE ) ) ) {
|
the_mq->Object.id, FALSE ) ) ) {
|
||||||
_POSIX_Message_queue_Free( the_mq );
|
_POSIX_Message_queue_Free( the_mq );
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( ENFILE );
|
rtems_set_errno_and_return_minus_one( ENFILE );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
the_mq = _POSIX_Message_queue_Allocate();
|
the_mq = _POSIX_Message_queue_Allocate();
|
||||||
if ( !the_mq ) {
|
if ( !the_mq ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( ENFILE );
|
rtems_set_errno_and_return_minus_one( ENFILE );
|
||||||
}
|
}
|
||||||
|
|
||||||
the_mq->process_shared = pshared;
|
the_mq->process_shared = pshared;
|
||||||
@@ -130,7 +130,7 @@ int _POSIX_Message_queue_Create_support(
|
|||||||
|
|
||||||
_POSIX_Message_queue_Free( the_mq );
|
_POSIX_Message_queue_Free( the_mq );
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( ENOSPC );
|
rtems_set_errno_and_return_minus_one( ENOSPC );
|
||||||
}
|
}
|
||||||
|
|
||||||
_Objects_Open(
|
_Objects_Open(
|
||||||
|
|||||||
@@ -47,16 +47,16 @@ int mq_getattr(
|
|||||||
CORE_message_queue_Attributes *the_mq_attr;
|
CORE_message_queue_Attributes *the_mq_attr;
|
||||||
|
|
||||||
if ( !mqstat )
|
if ( !mqstat )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EBADF );
|
rtems_set_errno_and_return_minus_one( EBADF );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
/*
|
/*
|
||||||
* Return the old values.
|
* Return the old values.
|
||||||
|
|||||||
@@ -70,16 +70,16 @@ int mq_notify(
|
|||||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EBADF );
|
rtems_set_errno_and_return_minus_one( EBADF );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
if ( notification ) {
|
if ( notification ) {
|
||||||
if ( _CORE_message_queue_Is_notify_enabled( &the_mq->Message_queue ) ) {
|
if ( _CORE_message_queue_Is_notify_enabled( &the_mq->Message_queue ) ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( EBUSY );
|
rtems_set_errno_and_return_minus_one( EBUSY );
|
||||||
}
|
}
|
||||||
|
|
||||||
_CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL, NULL );
|
_CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL, NULL );
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ mqd_t mq_open(
|
|||||||
|
|
||||||
if ( !( status == ENOENT && (oflag & O_CREAT) ) ) {
|
if ( !( status == ENOENT && (oflag & O_CREAT) ) ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one_cast( status, mqd_t );
|
rtems_set_errno_and_return_minus_one_cast( status, mqd_t );
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { /* name -> ID translation succeeded */
|
} else { /* name -> ID translation succeeded */
|
||||||
@@ -91,7 +91,7 @@ mqd_t mq_open(
|
|||||||
|
|
||||||
if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
|
if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one_cast( EEXIST, mqd_t );
|
rtems_set_errno_and_return_minus_one_cast( EEXIST, mqd_t );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -55,20 +55,20 @@ ssize_t _POSIX_Message_queue_Receive_support(
|
|||||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EBADF );
|
rtems_set_errno_and_return_minus_one( EBADF );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
if ( (the_mq->oflag & O_ACCMODE) == O_WRONLY ) {
|
if ( (the_mq->oflag & O_ACCMODE) == O_WRONLY ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( EBADF );
|
rtems_set_errno_and_return_minus_one( EBADF );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( msg_len < the_mq->Message_queue.maximum_message_size ) {
|
if ( msg_len < the_mq->Message_queue.maximum_message_size ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( EMSGSIZE );
|
rtems_set_errno_and_return_minus_one( EMSGSIZE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -94,7 +94,7 @@ ssize_t _POSIX_Message_queue_Receive_support(
|
|||||||
if ( !_Thread_Executing->Wait.return_code )
|
if ( !_Thread_Executing->Wait.return_code )
|
||||||
return length_out;
|
return length_out;
|
||||||
|
|
||||||
set_errno_and_return_minus_one(
|
rtems_set_errno_and_return_minus_one(
|
||||||
_POSIX_Message_queue_Translate_core_message_queue_return_code(
|
_POSIX_Message_queue_Translate_core_message_queue_return_code(
|
||||||
_Thread_Executing->Wait.return_code
|
_Thread_Executing->Wait.return_code
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -56,23 +56,23 @@ int _POSIX_Message_queue_Send_support(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ( msg_prio > MQ_PRIO_MAX )
|
if ( msg_prio > MQ_PRIO_MAX )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||||
|
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EBADF );
|
rtems_set_errno_and_return_minus_one( EBADF );
|
||||||
|
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
if ( (the_mq->oflag & O_ACCMODE) == O_RDONLY ) {
|
if ( (the_mq->oflag & O_ACCMODE) == O_RDONLY ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( EBADF );
|
rtems_set_errno_and_return_minus_one( EBADF );
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_status = _CORE_message_queue_Submit(
|
msg_status = _CORE_message_queue_Submit(
|
||||||
@@ -105,7 +105,7 @@ int _POSIX_Message_queue_Send_support(
|
|||||||
if ( !msg_status )
|
if ( !msg_status )
|
||||||
return msg_status;
|
return msg_status;
|
||||||
|
|
||||||
set_errno_and_return_minus_one(
|
rtems_set_errno_and_return_minus_one(
|
||||||
_POSIX_Message_queue_Translate_core_message_queue_return_code(
|
_POSIX_Message_queue_Translate_core_message_queue_return_code(
|
||||||
msg_status
|
msg_status
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -49,16 +49,16 @@ int mq_setattr(
|
|||||||
CORE_message_queue_Attributes *the_mq_attr;
|
CORE_message_queue_Attributes *the_mq_attr;
|
||||||
|
|
||||||
if ( !mqstat )
|
if ( !mqstat )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
the_mq = _POSIX_Message_queue_Get( mqdes, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EBADF );
|
rtems_set_errno_and_return_minus_one( EBADF );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
|
|
||||||
the_core_mq = &the_mq->Message_queue;
|
the_core_mq = &the_mq->Message_queue;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ int mq_unlink(
|
|||||||
status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id );
|
status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id );
|
||||||
if ( status != 0 ) {
|
if ( status != 0 ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( status );
|
rtems_set_errno_and_return_minus_one( status );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -59,7 +59,7 @@ int mq_unlink(
|
|||||||
|
|
||||||
if ( !_Objects_Is_local_id(the_mq_id) ) {
|
if ( !_Objects_Is_local_id(the_mq_id) ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
}
|
}
|
||||||
|
|
||||||
the_mq = (POSIX_Message_queue_Control *) _Objects_Get_local_object(
|
the_mq = (POSIX_Message_queue_Control *) _Objects_Get_local_object(
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ int nanosleep(
|
|||||||
struct timespec *the_rqtp;
|
struct timespec *the_rqtp;
|
||||||
|
|
||||||
if ( !rqtp )
|
if ( !rqtp )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
the_rqtp = (struct timespec *)rqtp;
|
the_rqtp = (struct timespec *)rqtp;
|
||||||
|
|
||||||
@@ -47,10 +47,10 @@ int nanosleep(
|
|||||||
the_rqtp->tv_sec = 0;
|
the_rqtp->tv_sec = 0;
|
||||||
|
|
||||||
if ( /* the_rqtp->tv_sec < 0 || */ the_rqtp->tv_nsec < 0 )
|
if ( /* the_rqtp->tv_sec < 0 || */ the_rqtp->tv_nsec < 0 )
|
||||||
set_errno_and_return_minus_one( EAGAIN );
|
rtems_set_errno_and_return_minus_one( EAGAIN );
|
||||||
|
|
||||||
if ( the_rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND )
|
if ( the_rqtp->tv_nsec >= TOD_NANOSECONDS_PER_SECOND )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
ticks = _POSIX_Timespec_to_interval( the_rqtp );
|
ticks = _POSIX_Timespec_to_interval( the_rqtp );
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ int nanosleep(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ticks )
|
if ( ticks )
|
||||||
set_errno_and_return_minus_one( EINTR );
|
rtems_set_errno_and_return_minus_one( EINTR );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -35,18 +35,18 @@ int pthread_kill(
|
|||||||
Objects_Locations location;
|
Objects_Locations location;
|
||||||
|
|
||||||
if ( sig && !is_valid_signo(sig) )
|
if ( sig && !is_valid_signo(sig) )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
/* commented out when posix timers added
|
/* commented out when posix timers added
|
||||||
if ( _POSIX_signals_Vectors[ sig ].sa_flags == SA_SIGINFO )
|
if ( _POSIX_signals_Vectors[ sig ].sa_flags == SA_SIGINFO )
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
the_thread = _POSIX_Threads_Get( thread, &location );
|
the_thread = _POSIX_Threads_Get( thread, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
set_errno_and_return_minus_one( ESRCH );
|
rtems_set_errno_and_return_minus_one( ESRCH );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
/*
|
/*
|
||||||
* If sig == 0 then just validate arguments
|
* If sig == 0 then just validate arguments
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ int pthread_sigmask(
|
|||||||
POSIX_API_Control *api;
|
POSIX_API_Control *api;
|
||||||
|
|
||||||
if ( !set && !oset )
|
if ( !set && !oset )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ int pthread_sigmask(
|
|||||||
api->signals_blocked = *set;
|
api->signals_blocked = *set;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX are there critical section problems here? */
|
/* XXX are there critical section problems here? */
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ int timer_create(
|
|||||||
if ( ( evp->sigev_notify != SIGEV_NONE ) &&
|
if ( ( evp->sigev_notify != SIGEV_NONE ) &&
|
||||||
( evp->sigev_notify != SIGEV_SIGNAL ) ) {
|
( evp->sigev_notify != SIGEV_SIGNAL ) ) {
|
||||||
/* The value of the field sigev_notify is not valid */
|
/* The value of the field sigev_notify is not valid */
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,7 +306,7 @@ int timer_create(
|
|||||||
/* There is not position for another timers in spite of RTEMS
|
/* There is not position for another timers in spite of RTEMS
|
||||||
* supports it. It will necessaty to increase the structure used */
|
* supports it. It will necessaty to increase the structure used */
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EAGAIN );
|
rtems_set_errno_and_return_minus_one( EAGAIN );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Exit parameter */
|
/* Exit parameter */
|
||||||
@@ -338,12 +338,12 @@ int timer_create(
|
|||||||
|
|
||||||
case RTEMS_INVALID_NAME : /* The assigned name is not valid */
|
case RTEMS_INVALID_NAME : /* The assigned name is not valid */
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
case RTEMS_TOO_MANY :
|
case RTEMS_TOO_MANY :
|
||||||
|
|
||||||
/* There has been created too much timers for the same process */
|
/* There has been created too much timers for the same process */
|
||||||
set_errno_and_return_minus_one( EAGAIN );
|
rtems_set_errno_and_return_minus_one( EAGAIN );
|
||||||
|
|
||||||
default :
|
default :
|
||||||
|
|
||||||
@@ -353,14 +353,14 @@ int timer_create(
|
|||||||
* rtems_timer_create can not return other different value.
|
* rtems_timer_create can not return other different value.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The next sentence is used to avoid singular situations
|
* The next sentence is used to avoid singular situations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -391,7 +391,7 @@ int timer_delete(
|
|||||||
|
|
||||||
if ( timer_pos == BAD_TIMER_C ) {
|
if ( timer_pos == BAD_TIMER_C ) {
|
||||||
/* The timer identifier is erroneus */
|
/* The timer identifier is erroneus */
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The timer is deleted */
|
/* The timer is deleted */
|
||||||
@@ -400,7 +400,7 @@ int timer_delete(
|
|||||||
|
|
||||||
if ( status == RTEMS_INVALID_ID ) {
|
if ( status == RTEMS_INVALID_ID ) {
|
||||||
/* The timer identifier is erroneus */
|
/* The timer identifier is erroneus */
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initializes the data of the timer */
|
/* Initializes the data of the timer */
|
||||||
@@ -437,14 +437,14 @@ int timer_settime(
|
|||||||
|
|
||||||
if ( timer_pos == BAD_TIMER_C ) {
|
if ( timer_pos == BAD_TIMER_C ) {
|
||||||
/* The timer identifier is erroneus */
|
/* The timer identifier is erroneus */
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( value == NULL ) {
|
if ( value == NULL ) {
|
||||||
/* The stucture of times of the timer is free, and then returns an
|
/* The stucture of times of the timer is free, and then returns an
|
||||||
error but the variable errno is not actualized */
|
error but the variable errno is not actualized */
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the function reaches this point, then it will be necessary to do
|
/* If the function reaches this point, then it will be necessary to do
|
||||||
@@ -487,7 +487,7 @@ int timer_settime(
|
|||||||
( value->it_value.tv_nsec < MIN_NSEC_C ) ) {
|
( value->it_value.tv_nsec < MIN_NSEC_C ) ) {
|
||||||
/* The number of nanoseconds is not correct */
|
/* The number of nanoseconds is not correct */
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Then, "value" must be converted from seconds and nanoseconds to clock
|
/* Then, "value" must be converted from seconds and nanoseconds to clock
|
||||||
@@ -610,7 +610,7 @@ int timer_settime(
|
|||||||
/* The timer identifier is not correct. In theory, this
|
/* The timer identifier is not correct. In theory, this
|
||||||
* situation can not occur, but the solution is easy */
|
* situation can not occur, but the solution is easy */
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -625,7 +625,7 @@ int timer_settime(
|
|||||||
* errno = EINVAL;
|
* errno = EINVAL;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
@@ -687,7 +687,7 @@ int timer_gettime(
|
|||||||
|
|
||||||
if ( timer_pos == BAD_TIMER_C ) {
|
if ( timer_pos == BAD_TIMER_C ) {
|
||||||
/* The timer identifier is erroneus */
|
/* The timer identifier is erroneus */
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculates the difference between the start time of the timer and
|
/* Calculates the difference between the start time of the timer and
|
||||||
@@ -774,7 +774,7 @@ int timer_getoverrun(
|
|||||||
|
|
||||||
if ( timer_pos == BAD_TIMER_C ) {
|
if ( timer_pos == BAD_TIMER_C ) {
|
||||||
/* The timer identifier is erroneus */
|
/* The timer identifier is erroneus */
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The overflow count of the timer is stored in "overrun" */
|
/* The overflow count of the timer is stored in "overrun" */
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ int sched_setparam(
|
|||||||
const struct sched_param *param
|
const struct sched_param *param
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
@@ -41,7 +41,7 @@ int sched_getparam(
|
|||||||
const struct sched_param *param
|
const struct sched_param *param
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
@@ -56,7 +56,7 @@ int sched_setscheduler(
|
|||||||
const struct sched_param *param
|
const struct sched_param *param
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
@@ -68,7 +68,7 @@ int sched_getscheduler(
|
|||||||
pid_t pid
|
pid_t pid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*PAGE
|
/*PAGE
|
||||||
@@ -88,7 +88,7 @@ int sched_get_priority_max(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
return POSIX_SCHEDULER_MAXIMUM_PRIORITY;
|
return POSIX_SCHEDULER_MAXIMUM_PRIORITY;
|
||||||
@@ -111,7 +111,7 @@ int sched_get_priority_min(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
return POSIX_SCHEDULER_MINIMUM_PRIORITY;
|
return POSIX_SCHEDULER_MINIMUM_PRIORITY;
|
||||||
@@ -134,10 +134,10 @@ int sched_rr_get_interval(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ( pid && pid != getpid() )
|
if ( pid && pid != getpid() )
|
||||||
set_errno_and_return_minus_one( ESRCH );
|
rtems_set_errno_and_return_minus_one( ESRCH );
|
||||||
|
|
||||||
if ( !interval )
|
if ( !interval )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
_POSIX_Interval_to_timespec( _Thread_Ticks_per_timeslice, interval );
|
_POSIX_Interval_to_timespec( _Thread_Ticks_per_timeslice, interval );
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <string.h> /* strlen */
|
||||||
|
|
||||||
#include <rtems/system.h>
|
#include <rtems/system.h>
|
||||||
#include <rtems/score/object.h>
|
#include <rtems/score/object.h>
|
||||||
@@ -44,13 +45,13 @@ int _POSIX_Semaphore_Create_support(
|
|||||||
/* Sharing semaphores among processes is not currently supported */
|
/* Sharing semaphores among processes is not currently supported */
|
||||||
if (pshared != 0) {
|
if (pshared != 0) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( name ) {
|
if ( name ) {
|
||||||
if( strlen(name) > PATH_MAX ) {
|
if( strlen(name) > PATH_MAX ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( ENAMETOOLONG );
|
rtems_set_errno_and_return_minus_one( ENAMETOOLONG );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ int _POSIX_Semaphore_Create_support(
|
|||||||
|
|
||||||
if ( !the_semaphore ) {
|
if ( !the_semaphore ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( ENOSPC );
|
rtems_set_errno_and_return_minus_one( ENOSPC );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
@@ -67,7 +68,7 @@ int _POSIX_Semaphore_Create_support(
|
|||||||
the_semaphore->Object.id, FALSE ) ) ) {
|
the_semaphore->Object.id, FALSE ) ) ) {
|
||||||
_POSIX_Semaphore_Free( the_semaphore );
|
_POSIX_Semaphore_Free( the_semaphore );
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( EAGAIN );
|
rtems_set_errno_and_return_minus_one( EAGAIN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ int _POSIX_Semaphore_Wait_support(
|
|||||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
_CORE_semaphore_Seize(
|
_CORE_semaphore_Seize(
|
||||||
&the_semaphore->Semaphore,
|
&the_semaphore->Semaphore,
|
||||||
@@ -53,11 +53,11 @@ int _POSIX_Semaphore_Wait_support(
|
|||||||
case CORE_SEMAPHORE_STATUS_SUCCESSFUL:
|
case CORE_SEMAPHORE_STATUS_SUCCESSFUL:
|
||||||
break;
|
break;
|
||||||
case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT:
|
case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT:
|
||||||
set_errno_and_return_minus_one( EAGAIN );
|
rtems_set_errno_and_return_minus_one( EAGAIN );
|
||||||
case CORE_SEMAPHORE_WAS_DELETED:
|
case CORE_SEMAPHORE_WAS_DELETED:
|
||||||
set_errno_and_return_minus_one( EAGAIN );
|
rtems_set_errno_and_return_minus_one( EAGAIN );
|
||||||
case CORE_SEMAPHORE_TIMEOUT:
|
case CORE_SEMAPHORE_TIMEOUT:
|
||||||
set_errno_and_return_minus_one( ETIMEDOUT );
|
rtems_set_errno_and_return_minus_one( ETIMEDOUT );
|
||||||
break;
|
break;
|
||||||
case CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED:
|
case CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED:
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ int sem_close(
|
|||||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
the_semaphore->open_count -= 1;
|
the_semaphore->open_count -= 1;
|
||||||
_POSIX_Semaphore_Delete( the_semaphore );
|
_POSIX_Semaphore_Delete( the_semaphore );
|
||||||
|
|||||||
@@ -35,11 +35,11 @@ int sem_destroy(
|
|||||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
/*
|
/*
|
||||||
* Undefined operation on a named semaphore.
|
* Undefined operation on a named semaphore.
|
||||||
@@ -47,7 +47,7 @@ int sem_destroy(
|
|||||||
|
|
||||||
if ( the_semaphore->named == TRUE ) {
|
if ( the_semaphore->named == TRUE ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
_POSIX_Semaphore_Delete( the_semaphore );
|
_POSIX_Semaphore_Delete( the_semaphore );
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ int sem_getvalue(
|
|||||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
*sval = _CORE_semaphore_Get_count( &the_semaphore->Semaphore );
|
*sval = _CORE_semaphore_Get_count( &the_semaphore->Semaphore );
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ int sem_init(
|
|||||||
POSIX_Semaphore_Control *the_semaphore;
|
POSIX_Semaphore_Control *the_semaphore;
|
||||||
|
|
||||||
if ( !sem )
|
if ( !sem )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
status = _POSIX_Semaphore_Create_support(
|
status = _POSIX_Semaphore_Create_support(
|
||||||
NULL,
|
NULL,
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ sem_t *sem_open(
|
|||||||
|
|
||||||
if ( !( status == ENOENT && (oflag & O_CREAT) ) ) {
|
if ( !( status == ENOENT && (oflag & O_CREAT) ) ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one_cast( status, sem_t * );
|
rtems_set_errno_and_return_minus_one_cast( status, sem_t * );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ sem_t *sem_open(
|
|||||||
|
|
||||||
if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
|
if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one_cast( EEXIST, sem_t * );
|
rtems_set_errno_and_return_minus_one_cast( EEXIST, sem_t * );
|
||||||
}
|
}
|
||||||
|
|
||||||
the_semaphore = _POSIX_Semaphore_Get( &the_semaphore_id, &location );
|
the_semaphore = _POSIX_Semaphore_Get( &the_semaphore_id, &location );
|
||||||
|
|||||||
@@ -35,11 +35,11 @@ int sem_post(
|
|||||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||||
switch ( location ) {
|
switch ( location ) {
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
return POSIX_MP_NOT_IMPLEMENTED();
|
return POSIX_MP_NOT_IMPLEMENTED();
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
_CORE_semaphore_Surrender(
|
_CORE_semaphore_Surrender(
|
||||||
&the_semaphore->Semaphore,
|
&the_semaphore->Semaphore,
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ int sem_unlink(
|
|||||||
status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id );
|
status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id );
|
||||||
if ( status != 0 ) {
|
if ( status != 0 ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( status );
|
rtems_set_errno_and_return_minus_one( status );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -52,7 +52,7 @@ int sem_unlink(
|
|||||||
|
|
||||||
if ( !_Objects_Is_local_id(the_semaphore_id) ) {
|
if ( !_Objects_Is_local_id(the_semaphore_id) ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
}
|
}
|
||||||
|
|
||||||
the_semaphore = (POSIX_Semaphore_Control *) _Objects_Get_local_object(
|
the_semaphore = (POSIX_Semaphore_Control *) _Objects_Get_local_object(
|
||||||
|
|||||||
@@ -25,5 +25,5 @@ int setpgid(
|
|||||||
pid_t pgid
|
pid_t pgid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
set_errno_and_return_minus_one( ENOSYS );
|
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
pid_t setsid( void )
|
pid_t setsid( void )
|
||||||
{
|
{
|
||||||
set_errno_and_return_minus_one( EPERM );
|
rtems_set_errno_and_return_minus_one( EPERM );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ int sigaction(
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( !is_valid_signo(sig) )
|
if ( !is_valid_signo(sig) )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some signals cannot be ignored (P1003.1b-1993, pp. 70-72 and references.
|
* Some signals cannot be ignored (P1003.1b-1993, pp. 70-72 and references.
|
||||||
@@ -56,7 +56,7 @@ int sigaction(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ( sig == SIGKILL )
|
if ( sig == SIGKILL )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Evaluate the new action structure and set the global signal vector
|
* Evaluate the new action structure and set the global signal vector
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ int sigaddset(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( !set )
|
if ( !set )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
if ( !signo )
|
if ( !signo )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( !is_valid_signo(signo) )
|
if ( !is_valid_signo(signo) )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
*set |= signo_to_mask(signo);
|
*set |= signo_to_mask(signo);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -33,13 +33,13 @@ int sigdelset(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( !set )
|
if ( !set )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
if ( !signo )
|
if ( !signo )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( !is_valid_signo(signo) )
|
if ( !is_valid_signo(signo) )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
*set &= ~signo_to_mask(signo);
|
*set &= ~signo_to_mask(signo);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ int sigemptyset(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( !set )
|
if ( !set )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
*set = 0;
|
*set = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ int sigfillset(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( !set )
|
if ( !set )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
*set = SIGNAL_ALL_MASK;
|
*set = SIGNAL_ALL_MASK;
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ int sigismember(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( !set )
|
if ( !set )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
if ( !signo )
|
if ( !signo )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( !is_valid_signo(signo) )
|
if ( !is_valid_signo(signo) )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
if ( *set & signo_to_mask(signo) )
|
if ( *set & signo_to_mask(signo) )
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ int sigpending(
|
|||||||
POSIX_API_Control *api;
|
POSIX_API_Control *api;
|
||||||
|
|
||||||
if ( !set )
|
if ( !set )
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
|
|
||||||
api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ int sigtimedwait(
|
|||||||
|
|
||||||
if ( timeout->tv_nsec < 0 ||
|
if ( timeout->tv_nsec < 0 ||
|
||||||
timeout->tv_nsec >= TOD_NANOSECONDS_PER_SECOND) {
|
timeout->tv_nsec >= TOD_NANOSECONDS_PER_SECOND) {
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
interval = _POSIX_Timespec_to_interval( timeout );
|
interval = _POSIX_Timespec_to_interval( timeout );
|
||||||
|
|||||||
Reference in New Issue
Block a user