Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osal Integration candidate: Caelum-rc4+dev23 #1299

Merged
merged 7 commits into from
Oct 3, 2022
Merged
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ The autogenerated OSAL user's guide can be viewed at <https://github.com/nasa/cF

## Changelog

### Development Build: v6.0.0-rc4+dev116
- Use fstat and fchmod for TOCTOU Bug
- Remove 'return;' from last line of void functions.
- Remove unnecessary parentheses around return values.
- See <https://github.com/nasa/osal/pull/1181>, <https://github.com/nasa/osal/pull/1294>, and <https://github.com/nasa/osal/pull/1292>

### Development Build: v6.0.0-rc4+dev108
- condition variable API for OSAL
- See <https://github.com/nasa/osal/issues/1252>
Expand Down
2 changes: 1 addition & 1 deletion src/os/inc/osapi-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/*
* Development Build Macro Definitions
*/
#define OS_BUILD_NUMBER 108
#define OS_BUILD_NUMBER 116
#define OS_BUILD_BASELINE "v6.0.0-rc4"

/*
Expand Down
2 changes: 1 addition & 1 deletion src/os/portable/os-impl-no-symtab.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ int32 OS_ModuleSymbolLookup_Impl(const OS_object_token_t *token, cpuaddr *Symbol
*-----------------------------------------------------------------*/
int32 OS_SymbolTableDump_Impl(const char *filename, size_t SizeLimit)
{
return (OS_ERR_NOT_IMPLEMENTED);
return OS_ERR_NOT_IMPLEMENTED;
}
2 changes: 1 addition & 1 deletion src/os/portable/os-impl-posix-dl-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,6 @@ int32 OS_ModuleGetInfo_Impl(const OS_object_token_t *token, OS_module_prop_t *mo
* This returns success - although there is no information to add here,
* the parent/shared layer information is still valid.
*/
return (OS_SUCCESS);
return OS_SUCCESS;

} /* end OS_ModuleGetInfo_Impl */
2 changes: 1 addition & 1 deletion src/os/portable/os-impl-posix-dl-symtab.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,6 @@ int32 OS_SymbolTableDump_Impl(const char *filename, size_t SizeLimit)
* unimplemented here.
*/

return (OS_ERR_NOT_IMPLEMENTED);
return OS_ERR_NOT_IMPLEMENTED;

} /* end OS_SymbolTableDump_Impl */
4 changes: 2 additions & 2 deletions src/os/portable/os-impl-posix-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ int32 OS_GenericRead_Impl(const OS_object_token_t *token, void *buffer, size_t n
}
}

return (return_code);
return return_code;
} /* end OS_GenericRead_Impl */

/*----------------------------------------------------------------
Expand Down Expand Up @@ -269,5 +269,5 @@ int32 OS_GenericWrite_Impl(const OS_object_token_t *token, const void *buffer, s
}
}

return (return_code);
return return_code;
} /* end OS_GenericWrite_Impl */
2 changes: 1 addition & 1 deletion src/os/portable/os-impl-posix-network.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int32 OS_NetworkGetHostName_Impl(char *host_name, size_t name_len)
return_code = OS_SUCCESS;
}

return (return_code);
return return_code;
} /* end OS_NetworkGetHostName_Impl */

/*----------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions src/os/posix/src/os-impl-binsem.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ int32 OS_BinSemGive_Impl(const OS_object_token_t *token)
/* Lock the mutex ( not the table! ) */
if (OS_Posix_BinSemAcquireMutex(&sem->id) != OS_SUCCESS)
{
return (OS_SEM_FAILURE);
return OS_SEM_FAILURE;
}

/* Binary semaphores are always set as "1" when given */
Expand Down Expand Up @@ -343,7 +343,7 @@ int32 OS_BinSemFlush_Impl(const OS_object_token_t *token)
/* Lock the mutex ( not the table! ) */
if (OS_Posix_BinSemAcquireMutex(&sem->id) != OS_SUCCESS)
{
return (OS_SEM_FAILURE);
return OS_SEM_FAILURE;
}

/* increment the flush counter. Any other threads that are
Expand Down Expand Up @@ -383,7 +383,7 @@ static int32 OS_GenericBinSemTake_Impl(const OS_object_token_t *token, const str
/* Lock the mutex ( not the table! ) */
if (OS_Posix_BinSemAcquireMutex(&sem->id) != OS_SUCCESS)
{
return (OS_SEM_FAILURE);
return OS_SEM_FAILURE;
}

/* because pthread_cond_wait() is also a cancellation point,
Expand Down
2 changes: 1 addition & 1 deletion src/os/posix/src/os-impl-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ int32 OS_API_Impl_Init(osal_objtype_t idtype)
break;
}

return (return_code);
return return_code;
} /* end OS_API_Impl_Init */

/*----------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/os/posix/src/os-impl-filesys.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ int32 OS_FileSysStatVolume_Impl(const OS_object_token_t *token, OS_statvfs_t *re
result->blocks_free = OSAL_BLOCKCOUNT_C(stat_buf.f_bfree);
result->total_blocks = OSAL_BLOCKCOUNT_C(stat_buf.f_blocks);

return (OS_SUCCESS);
return OS_SUCCESS;
} /* end OS_FileSysStatVolume_Impl */

/*----------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/os/posix/src/os-impl-heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ int32 OS_HeapGetInfo_Impl(OS_heap_prop_t *heap_prop)
/*
** Not implemented yet
*/
return (OS_ERR_NOT_IMPLEMENTED);
return OS_ERR_NOT_IMPLEMENTED;
} /* end OS_HeapGetInfo_Impl */
2 changes: 1 addition & 1 deletion src/os/posix/src/os-impl-idmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,5 +248,5 @@ int32 OS_Posix_TableMutex_Init(osal_objtype_t idtype)
}
} while (0);

return (return_code);
return return_code;
} /* end OS_Posix_TableMutex_Init */
2 changes: 1 addition & 1 deletion src/os/posix/src/os-impl-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ OS_impl_module_internal_record_t OS_impl_module_table[OS_MAX_MODULES];
int32 OS_Posix_ModuleAPI_Impl_Init(void)
{
memset(OS_impl_module_table, 0, sizeof(OS_impl_module_table));
return (OS_SUCCESS);
return OS_SUCCESS;
} /* end OS_Posix_ModuleAPI_Impl_Init */
2 changes: 1 addition & 1 deletion src/os/posix/src/os-impl-no-module.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@
int32 OS_Posix_ModuleAPI_Impl_Init(void)
{
/* nothing to init in this mode */
return (OS_SUCCESS);
return OS_SUCCESS;
} /* end OS_Posix_ModuleAPI_Impl_Init */
20 changes: 10 additions & 10 deletions src/os/posix/src/os-impl-tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ int32 OS_Posix_InternalTaskCreate_Impl(pthread_t *pthr, osal_priority_t priority
if (return_code != 0)
{
OS_DEBUG("pthread_attr_init error in OS_TaskCreate: %s\n", strerror(return_code));
return (OS_ERROR);
return OS_ERROR;
}

/*
Expand Down Expand Up @@ -479,7 +479,7 @@ int32 OS_Posix_InternalTaskCreate_Impl(pthread_t *pthr, osal_priority_t priority
if (return_code != 0)
{
OS_DEBUG("pthread_attr_setstacksize error in OS_TaskCreate: %s\n", strerror(return_code));
return (OS_ERROR);
return OS_ERROR;
}

/*
Expand All @@ -489,7 +489,7 @@ int32 OS_Posix_InternalTaskCreate_Impl(pthread_t *pthr, osal_priority_t priority
if (return_code != 0)
{
OS_DEBUG("pthread_attr_setdetachstate error in OS_TaskCreate: %s\n", strerror(return_code));
return (OS_ERROR);
return OS_ERROR;
}

/*
Expand All @@ -506,7 +506,7 @@ int32 OS_Posix_InternalTaskCreate_Impl(pthread_t *pthr, osal_priority_t priority
if (return_code != 0)
{
OS_DEBUG("pthread_attr_setinheritsched error in OS_TaskCreate, errno = %s\n", strerror(return_code));
return (OS_ERROR);
return OS_ERROR;
}

/*
Expand All @@ -517,7 +517,7 @@ int32 OS_Posix_InternalTaskCreate_Impl(pthread_t *pthr, osal_priority_t priority
if (return_code != 0)
{
OS_DEBUG("pthread_attr_setschedpolity error in OS_TaskCreate: %s\n", strerror(return_code));
return (OS_ERROR);
return OS_ERROR;
}

/*
Expand All @@ -527,15 +527,15 @@ int32 OS_Posix_InternalTaskCreate_Impl(pthread_t *pthr, osal_priority_t priority
if (return_code != 0)
{
OS_DEBUG("pthread_attr_getschedparam error in OS_TaskCreate: %s\n", strerror(return_code));
return (OS_ERROR);
return OS_ERROR;
}

priority_holder.sched_priority = OS_PriorityRemap(priority);
return_code = pthread_attr_setschedparam(&custom_attr, &priority_holder);
if (return_code != 0)
{
OS_DEBUG("pthread_attr_setschedparam error in OS_TaskCreate: %s\n", strerror(return_code));
return (OS_ERROR);
return OS_ERROR;
}

} /* End if user is root */
Expand All @@ -547,7 +547,7 @@ int32 OS_Posix_InternalTaskCreate_Impl(pthread_t *pthr, osal_priority_t priority
if (return_code != 0)
{
OS_DEBUG("pthread_create error in OS_TaskCreate: %s\n", strerror(return_code));
return (OS_ERROR);
return OS_ERROR;
}

/*
Expand Down Expand Up @@ -778,7 +778,7 @@ int32 OS_TaskSetPriority_Impl(const OS_object_token_t *token, osal_priority_t ne
{
OS_DEBUG("pthread_setschedprio: Task ID = %lu, prio = %d, err = %s\n",
OS_ObjectIdToInteger(OS_ObjectIdFromToken(token)), os_priority, strerror(ret));
return (OS_ERROR);
return OS_ERROR;
}
}

Expand Down Expand Up @@ -840,7 +840,7 @@ osal_id_t OS_TaskGetId_Impl(void)

self_record.opaque_arg = pthread_getspecific(POSIX_GlobalVars.ThreadKey);

return (self_record.id);
return self_record.id;
} /* end OS_TaskGetId_Impl */

/*----------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/os/posix/src/os-impl-timebase.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ int32 OS_Posix_TimeBaseAPI_Impl_Init(void)
(1000000 + (OS_SharedGlobalVars.TicksPerSecond / 2)) / OS_SharedGlobalVars.TicksPerSecond;
} while (0);

return (return_code);
return return_code;
} /* end OS_Posix_TimeBaseAPI_Impl_Init */

/****************************************************************************************
Expand Down Expand Up @@ -568,7 +568,7 @@ int32 OS_TimeBaseDelete_Impl(const OS_object_token_t *token)
if (status < 0)
{
OS_DEBUG("Error deleting timer: %s\n", strerror(errno));
return (OS_TIMER_ERR_INTERNAL);
return OS_TIMER_ERR_INTERNAL;
}

local->assigned_signal = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/os/rtems/src/os-impl-binsem.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ OS_impl_binsem_internal_record_t OS_impl_bin_sem_table[OS_MAX_BIN_SEMAPHORES];
int32 OS_Rtems_BinSemAPI_Impl_Init(void)
{
memset(OS_impl_bin_sem_table, 0, sizeof(OS_impl_bin_sem_table));
return (OS_SUCCESS);
return OS_SUCCESS;
} /* end OS_Rtems_BinSemAPI_Impl_Init */

/*----------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/os/rtems/src/os-impl-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ int32 OS_API_Impl_Init(osal_objtype_t idtype)
break;
}

return (return_code);
return return_code;
} /* end OS_API_Impl_Init */

/*----------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/os/rtems/src/os-impl-countsem.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ OS_impl_countsem_internal_record_t OS_impl_count_sem_table[OS_MAX_COUNT_SEMAPHOR
int32 OS_Rtems_CountSemAPI_Impl_Init(void)
{
memset(OS_impl_count_sem_table, 0, sizeof(OS_impl_count_sem_table));
return (OS_SUCCESS);
return OS_SUCCESS;
} /* end OS_Rtems_CountSemAPI_Impl_Init */

/*----------------------------------------------------------------
Expand Down Expand Up @@ -165,7 +165,7 @@ int32 OS_CountSemGive_Impl(const OS_object_token_t *token)
return OS_SEM_FAILURE;
}

return (OS_SUCCESS);
return OS_SUCCESS;

} /* end OS_CountSemGive_Impl */

Expand Down
2 changes: 1 addition & 1 deletion src/os/rtems/src/os-impl-filesys.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ int32 OS_FileSysStatVolume_Impl(const OS_object_token_t *token, OS_statvfs_t *re
return_code = OS_SUCCESS;
}

return (return_code);
return return_code;
} /* end OS_FileSysStatVolume_Impl */

/*----------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/os/rtems/src/os-impl-heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ int32 OS_HeapGetInfo_Impl(OS_heap_prop_t *heap_prop)

if (status != 0)
{
return (OS_ERROR);
return OS_ERROR;
}

heap_prop->free_bytes = (uint32)info.Free.total;
heap_prop->free_blocks = (uint32)info.Free.number;
heap_prop->largest_free_block = (uint32)info.Free.largest;

return (OS_SUCCESS);
return OS_SUCCESS;
} /* end OS_HeapGetInfo_Impl */
2 changes: 1 addition & 1 deletion src/os/rtems/src/os-impl-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ OS_impl_module_internal_record_t OS_impl_module_table[OS_MAX_MODULES];
int32 OS_Rtems_ModuleAPI_Impl_Init(void)
{
memset(OS_impl_module_table, 0, sizeof(OS_impl_module_table));
return (OS_SUCCESS);
return OS_SUCCESS;
} /* end OS_Rtems_ModuleAPI_Impl_Init */

/****************************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion src/os/rtems/src/os-impl-mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ OS_impl_mutex_internal_record_t OS_impl_mutex_table[OS_MAX_MUTEXES];
int32 OS_Rtems_MutexAPI_Impl_Init(void)
{
memset(OS_impl_mutex_table, 0, sizeof(OS_impl_mutex_table));
return (OS_SUCCESS);
return OS_SUCCESS;
} /* end OS_Rtems_MutexAPI_Impl_Init */

/*----------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/os/rtems/src/os-impl-network.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ int32 OS_NetworkGetHostName_Impl(char *host_name, size_t name_len)
return_code = OS_SUCCESS;
}

return (return_code);
return return_code;
} /* end OS_NetworkGetHostName_Impl */
2 changes: 1 addition & 1 deletion src/os/rtems/src/os-impl-no-module.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@
int32 OS_Rtems_ModuleAPI_Impl_Init(void)
{
/* nothing to init, but needs to return SUCCESS to allow the rest of OSAL to work */
return (OS_SUCCESS);
return OS_SUCCESS;
} /* end OS_Rtems_ModuleAPI_Impl_Init */
2 changes: 1 addition & 1 deletion src/os/rtems/src/os-impl-queues.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ OS_impl_queue_internal_record_t OS_impl_queue_table[OS_MAX_QUEUES];
int32 OS_Rtems_QueueAPI_Impl_Init(void)
{
memset(OS_impl_queue_table, 0, sizeof(OS_impl_queue_table));
return (OS_SUCCESS);
return OS_SUCCESS;
} /* end OS_Rtems_QueueAPI_Impl_Init */

/*----------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions src/os/rtems/src/os-impl-tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static rtems_task OS_RtemsEntry(rtems_task_argument arg)
int32 OS_Rtems_TaskAPI_Impl_Init(void)
{
memset(OS_impl_task_table, 0, sizeof(OS_impl_task_table));
return (OS_SUCCESS);
return OS_SUCCESS;
} /* end OS_Rtems_TaskAPI_Impl_Init */

/*----------------------------------------------------------------
Expand Down Expand Up @@ -230,7 +230,7 @@ int32 OS_TaskDelay_Impl(uint32 milli_second)
*/
rtems_task_wake_after((rtems_interval)tick_count);

return (return_code);
return return_code;

} /* end OS_TaskDelay_Impl */

Expand Down Expand Up @@ -281,7 +281,7 @@ int32 OS_TaskMatch_Impl(const OS_object_token_t *token)
*/
if (rtems_task_self() != impl->id)
{
return (OS_ERROR);
return OS_ERROR;
}

return OS_SUCCESS;
Expand Down
2 changes: 1 addition & 1 deletion src/os/rtems/src/os-impl-timebase.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ int32 OS_Rtems_TimeBaseAPI_Impl_Init(void)
*/
OS_SharedGlobalVars.MicroSecPerTick = (RTEMS_GlobalVars.ClockAccuracyNsec + 500) / 1000;

return (OS_SUCCESS);
return OS_SUCCESS;
} /* end OS_Rtems_TimeBaseAPI_Impl_Init */

/****************************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion src/os/shared/src/osapi-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ int32 OS_API_Init(void)
OS_SharedGlobalVars.GlobalState = OS_SHUTDOWN_MAGIC_NUMBER;
}

return (return_code);
return return_code;
} /* end OS_API_Init */

/*----------------------------------------------------------------
Expand Down
Loading