diff --git a/.github/workflows/codeql-build.yml b/.github/workflows/codeql-build.yml new file mode 100644 index 000000000..46f0ee81f --- /dev/null +++ b/.github/workflows/codeql-build.yml @@ -0,0 +1,58 @@ +name: "CodeQL Analysis" + +on: + push: + pull_request: + +env: + SIMULATION: native + ENABLE_UNIT_TESTS: true + OMIT_DEPRECATED: true + BUILDTYPE: release + +jobs: + + CodeQL-Build: + runs-on: ubuntu-18.04 + timeout-minutes: 15 + + steps: + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout bundle + uses: actions/checkout@v2 + with: + repository: nasa/cFS + submodules: true + + - name: Checkout submodule + uses: actions/checkout@v2 + with: + path: osal + + - name: Check versions + run: git submodule + + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: c + queries: +security-extended, security-and-quality + + # Setup the build system + - name: Set up for build + run: | + cp ./cfe/cmake/Makefile.sample Makefile + cp -r ./cfe/cmake/sample_defs sample_defs + make prep + + # Build the code + - name: Build + run: | + make osal + make native/default_cpu1/osal/tests/ + make native/default_cpu1/osal/unit-test-coverage/ + make native/default_cpu1/osal/unit-tests/ + make native/default_cpu1/osal/ut-stubs/ + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/format-check.yml b/.github/workflows/format-check.yml new file mode 100644 index 000000000..0a998eccb --- /dev/null +++ b/.github/workflows/format-check.yml @@ -0,0 +1,53 @@ +name: Format Check + +# Run on main push and pull requests +on: + push: + branches: + - main + pull_request: + +jobs: + + static-analysis: + name: Run format check + runs-on: ubuntu-18.04 + timeout-minutes: 15 + + steps: + + - name: Install format checker + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main' + sudo apt-get update && sudo apt-get install clang-format-10 + + - name: Checkout bundle + uses: actions/checkout@v2 + with: + repository: nasa/cFS + + - name: Checkout + uses: actions/checkout@v2 + with: + path: repo + + - name: Generate format differences + run: | + cd repo + find . -name "*.[ch]" -exec clang-format-10 -i -style=file {} + + git diff > $GITHUB_WORKSPACE/style_differences.txt + + - name: Archive Static Analysis Artifacts + uses: actions/upload-artifact@v2 + with: + name: style_differences + path: style_differences.txt + + - name: Error on differences + run: | + if [[ -s style_differences.txt ]]; + then + cat style_differences.txt + exit -1 + fi diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 3a4f0e9cd..b81b11aa5 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -12,6 +12,7 @@ jobs: static-analysis: name: Run cppcheck runs-on: ubuntu-18.04 + timeout-minutes: 15 strategy: fail-fast: false diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 17b4806e5..000000000 --- a/.travis.yml +++ /dev/null @@ -1,61 +0,0 @@ -os: linux -dist: bionic -language: c -compiler: - - gcc -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - cmake cppcheck lcov - -_functional_test: &functional_test - script: - # Check versions - - cppcheck --version - - #cppcheck flight software osal/src/bsp, osal/src/os - - cppcheck --force --inline-suppr --std=c99 --language=c --error-exitcode=1 - --enable=warning,performance,portability,style --suppress=variableScope - --inconclusive --quiet src/bsp src/os 2>cppcheck_flight_osal.txt - - | - if [[ -s cppcheck_flight_osal.txt ]]; then - echo "You must fix cppcheck errors before submitting a pull request" - echo "" - cat cppcheck_flight_osal.txt - exit -1 - fi - - # Setup - - mkdir build - - cd build - - # Prep and build - - cmake -DENABLE_UNIT_TESTS=true -DOSAL_SYSTEM_BSPTYPE=generic-linux -DOSAL_CONFIG_DEBUG_PERMISSIVE_MODE=TRUE .. - - make - - # lcov capture pre-execution - - lcov --rc lcov_branch_coverage=1 --capture --initial --directory ./ --output-file coverage_base.info - - # Test - - make test - - # lcov post run analysis - - lcov --rc lcov_branch_coverage=1 --capture --directory ./ --output-file coverage_test.info - - lcov --rc lcov_branch_coverage=1 --add-tracefile coverage_base.info --add-tracefile - coverage_test.info --output-file coverage_total.info - - lcov --rc lcov_branch_coverage=1 --remove coverage_total.info '*unit-test-coverage*' - --output-file coverage_filtered.info - - genhtml coverage_filtered.info --output-directory lcov - -jobs: - include: - - env: BUILDTYPE=release OSAL_OMIT_DEPRECATED=true - <<: *functional_test - - env: BUILDTYPE=release OSAL_OMIT_DEPRECATED=false - <<: *functional_test - - env: BUILDTYPE=debug OSAL_OMIT_DEPRECATED=true - <<: *functional_test - - env: BUILDTYPE=debug OSAL_OMIT_DEPRECATED=false - <<: *functional_test diff --git a/README.md b/README.md index 51e3caaff..01a94dd59 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -Travis-CI: [![Build Status](https://travis-ci.com/nasa/osal.svg)](https://travis-ci.com/nasa/osal) +![Static Analysis](https://github.com/nasa/osal/workflows/Static%20Analysis/badge.svg) +![Format Check](https://github.com/nasa/osal/workflows/Format%20Check/badge.svg) # Core Flight System : Framework : Operating System Abstraction Layer @@ -10,6 +11,28 @@ The autogenerated OSAL user's guide can be viewed at + ### Development Build: 5.1.0-rc1+dev221 - Fixes `printf` format to correctly build in RTEMS-5. diff --git a/src/bsp/generic-linux/src/generic_linux_bsp_internal.h b/src/bsp/generic-linux/src/generic_linux_bsp_internal.h index 75548fe08..85ab8145e 100644 --- a/src/bsp/generic-linux/src/generic_linux_bsp_internal.h +++ b/src/bsp/generic-linux/src/generic_linux_bsp_internal.h @@ -46,4 +46,4 @@ typedef struct */ extern OS_BSP_GenericLinuxGlobalData_t OS_BSP_GenericLinuxGlobal; -#endif /* GENERIC_LINUX_BSP_INTERNAL_H */ +#endif /* GENERIC_LINUX_BSP_INTERNAL_H */ diff --git a/src/bsp/generic-vxworks/src/generic_vxworks_bsp_internal.h b/src/bsp/generic-vxworks/src/generic_vxworks_bsp_internal.h index b879a4c16..640603c4a 100644 --- a/src/bsp/generic-vxworks/src/generic_vxworks_bsp_internal.h +++ b/src/bsp/generic-vxworks/src/generic_vxworks_bsp_internal.h @@ -33,4 +33,4 @@ */ #include "bsp-impl.h" -#endif /* GENERIC_VXWORKS_BSP_INTERNAL_H */ +#endif /* GENERIC_VXWORKS_BSP_INTERNAL_H */ diff --git a/src/bsp/pc-rtems/src/bsp_start.c b/src/bsp/pc-rtems/src/bsp_start.c index ce6ef503e..cb2e43542 100644 --- a/src/bsp/pc-rtems/src/bsp_start.c +++ b/src/bsp/pc-rtems/src/bsp_start.c @@ -370,16 +370,16 @@ rtems_task Init(rtems_task_argument ignored) * 16 internal semaphores * */ -#define CONFIGURE_MAXIMUM_TASKS (OS_MAX_TASKS + 8) -#define CONFIGURE_MAXIMUM_TIMERS (OS_MAX_TIMERS + 2) -#define CONFIGURE_MAXIMUM_SEMAPHORES (OS_MAX_BIN_SEMAPHORES + OS_MAX_COUNT_SEMAPHORES + OS_MAX_MUTEXES + 16) -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES (OS_MAX_QUEUES + 4) -#define CONFIGURE_MAXIMUM_DRIVERS 10 -#define CONFIGURE_MAXIMUM_POSIX_KEYS 4 +#define CONFIGURE_MAXIMUM_TASKS (OS_MAX_TASKS + 8) +#define CONFIGURE_MAXIMUM_TIMERS (OS_MAX_TIMERS + 2) +#define CONFIGURE_MAXIMUM_SEMAPHORES (OS_MAX_BIN_SEMAPHORES + OS_MAX_COUNT_SEMAPHORES + OS_MAX_MUTEXES + 16) +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES (OS_MAX_QUEUES + 4) +#define CONFIGURE_MAXIMUM_DRIVERS 10 +#define CONFIGURE_MAXIMUM_POSIX_KEYS 4 #ifdef _RTEMS_5_ - #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS (OS_MAX_NUM_OPEN_FILES + 8) +#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS (OS_MAX_NUM_OPEN_FILES + 8) #else - #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS (OS_MAX_NUM_OPEN_FILES + 8) +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS (OS_MAX_NUM_OPEN_FILES + 8) #endif #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/src/bsp/pc-rtems/src/pcrtems_bsp_internal.h b/src/bsp/pc-rtems/src/pcrtems_bsp_internal.h index 919e219a4..67f7ff1cb 100644 --- a/src/bsp/pc-rtems/src/pcrtems_bsp_internal.h +++ b/src/bsp/pc-rtems/src/pcrtems_bsp_internal.h @@ -43,9 +43,9 @@ * Handle the differences between RTEMS 5 and 4.11 copyright notice */ #ifdef _RTEMS_5_ - #define OSAL_BSP_COPYRIGHT_NOTICE rtems_get_copyright_notice() +#define OSAL_BSP_COPYRIGHT_NOTICE rtems_get_copyright_notice() #else - #define OSAL_BSP_COPYRIGHT_NOTICE _Copyright_Notice +#define OSAL_BSP_COPYRIGHT_NOTICE _Copyright_Notice #endif /* @@ -73,4 +73,4 @@ typedef struct */ extern OS_BSP_PcRtemsGlobalData_t OS_BSP_PcRtemsGlobal; -#endif /* PCRTEMS_BSP_INTERNAL_H */ +#endif /* PCRTEMS_BSP_INTERNAL_H */ diff --git a/src/os/inc/osapi-binsem.h b/src/os/inc/osapi-binsem.h index 99c18e4d2..4474450bc 100644 --- a/src/os/inc/osapi-binsem.h +++ b/src/os/inc/osapi-binsem.h @@ -28,7 +28,6 @@ #include "osconfig.h" #include "common_types.h" - /** @defgroup OSSemaphoreStates OSAL Semaphore State Defines * @{ */ @@ -36,7 +35,6 @@ #define OS_SEM_EMPTY 0 /**< @brief Semaphore empty state */ /**@}*/ - /** @brief OSAL binary semaphore properties */ typedef struct { diff --git a/src/os/inc/osapi-bsp.h b/src/os/inc/osapi-bsp.h index ff8f95120..3fa39d140 100644 --- a/src/os/inc/osapi-bsp.h +++ b/src/os/inc/osapi-bsp.h @@ -28,7 +28,6 @@ #include "osconfig.h" #include "common_types.h" - /**************************************************************************************** BSP LOW-LEVEL IMPLEMENTATION FUNCTIONS ****************************************************************************************/ diff --git a/src/os/inc/osapi-clock.h b/src/os/inc/osapi-clock.h index fa854209f..b2fb0349d 100644 --- a/src/os/inc/osapi-clock.h +++ b/src/os/inc/osapi-clock.h @@ -44,18 +44,17 @@ */ typedef struct { - int64 ticks; /**< Ticks elapsed since reference point */ + int64 ticks; /**< Ticks elapsed since reference point */ } OS_time_t; - /** * @brief Multipliers/divisors to convert ticks into standardized units - * + * * Various fixed conversion factor constants used by the conversion routines - * + * * A 100ns tick time allows max intervals of about +/- 14000 years in * a 64-bit signed integer value. - * + * * @note Applications should not directly use these values, but rather use * conversion routines below to obtain standardized units (seconds/microseconds/etc). */ @@ -99,7 +98,6 @@ int32 OS_GetLocalTime(OS_time_t *time_struct); */ int32 OS_SetLocalTime(const OS_time_t *time_struct); - /*-------------------------------------------------------------------------------------*/ /* * Accessor / Unit Conversion routines for OS_time_t @@ -217,7 +215,6 @@ static inline uint32 OS_TimeGetSubsecondsPart(OS_time_t tm) return (uint32)((frac - 1) / (OS_TIME_TICKS_PER_SECOND >> 2)); } - /*-------------------------------------------------------------------------------------*/ /** * @brief Get milliseconds portion (fractional part only) from an OS_time_t object @@ -351,7 +348,6 @@ static inline OS_time_t OS_TimeAssembleFromMilliseconds(int64 seconds, uint32 mi return result; } - /*-------------------------------------------------------------------------------------*/ /** * @brief Assemble/Convert a number of seconds + subseconds into an OS_time_t interval @@ -387,7 +383,7 @@ static inline OS_time_t OS_TimeAssembleFromSubseconds(int64 seconds, uint32 subs */ static inline OS_time_t OS_TimeAdd(OS_time_t time1, OS_time_t time2) { - return ((OS_time_t) { time1.ticks + time2.ticks }); + return ((OS_time_t) {time1.ticks + time2.ticks}); } /*-------------------------------------------------------------------------------------*/ @@ -401,10 +397,9 @@ static inline OS_time_t OS_TimeAdd(OS_time_t time1, OS_time_t time2) */ static inline OS_time_t OS_TimeSubtract(OS_time_t time1, OS_time_t time2) { - return ((OS_time_t) { time1.ticks - time2.ticks }); + return ((OS_time_t) {time1.ticks - time2.ticks}); } - /**@}*/ #endif diff --git a/src/os/inc/osapi-common.h b/src/os/inc/osapi-common.h index 5a2c66db7..ac6b1bcdc 100644 --- a/src/os/inc/osapi-common.h +++ b/src/os/inc/osapi-common.h @@ -28,7 +28,6 @@ #include "osconfig.h" #include "common_types.h" - /** * @brief A set of events that can be used with BSP event callback routines */ @@ -98,7 +97,6 @@ typedef enum */ typedef int32 (*OS_EventHandler_t)(OS_Event_t event, osal_id_t object_id, void *data); - /** @defgroup OSAPICore OSAL Core Operation APIs * * These are for OSAL core operations for startup/initialization, running, and shutdown. diff --git a/src/os/inc/osapi-constants.h b/src/os/inc/osapi-constants.h index 0d10fdf46..e3aa32f1c 100644 --- a/src/os/inc/osapi-constants.h +++ b/src/os/inc/osapi-constants.h @@ -34,7 +34,6 @@ #define OS_PEND (-1) #define OS_CHECK (0) - /** * @brief Initializer for the osal_id_t type which will not match any valid value */ @@ -54,5 +53,4 @@ */ #define OS_MAX_LOCAL_PATH_LEN (OS_MAX_PATH_LEN + OS_FS_PHYS_NAME_LEN) - #endif diff --git a/src/os/inc/osapi-dir.h b/src/os/inc/osapi-dir.h index a2c6f3e2f..a9c594dcc 100644 --- a/src/os/inc/osapi-dir.h +++ b/src/os/inc/osapi-dir.h @@ -28,8 +28,6 @@ #include "osconfig.h" #include "common_types.h" - - /** @brief Directory entry */ typedef struct { diff --git a/src/os/inc/osapi-error.h b/src/os/inc/osapi-error.h index 77bfcf296..c0af8e57e 100644 --- a/src/os/inc/osapi-error.h +++ b/src/os/inc/osapi-error.h @@ -82,7 +82,7 @@ typedef char os_err_name_t[OS_ERROR_NAME_LENGTH]; #define OS_ERR_INCORRECT_OBJ_STATE (-35) /**< @brief Incorrect object state */ #define OS_ERR_INCORRECT_OBJ_TYPE (-36) /**< @brief Incorrect object type */ #define OS_ERR_STREAM_DISCONNECTED (-37) /**< @brief Stream disconnected */ -#define OS_ERR_OPERATION_NOT_SUPPORTED (-38) /**< @brief Requested operation is not support on the supplied object(s) */ +#define OS_ERR_OPERATION_NOT_SUPPORTED (-38) /**< @brief Requested operation not support on supplied object(s) */ #define OS_ERR_INVALID_SIZE (-40) /**< @brief Invalid Size */ /* @@ -99,10 +99,8 @@ typedef char os_err_name_t[OS_ERROR_NAME_LENGTH]; #define OS_FS_ERR_DEVICE_NOT_FREE (-107) /**< @brief FS device not free */ #define OS_FS_ERR_PATH_INVALID (-108) /**< @brief FS path invalid */ - /**@}*/ - /** @defgroup OSAPIError OSAL Error Info APIs * @{ */ @@ -119,5 +117,4 @@ typedef char os_err_name_t[OS_ERROR_NAME_LENGTH]; int32 OS_GetErrorName(int32 error_num, os_err_name_t *err_name); /**@}*/ - #endif diff --git a/src/os/inc/osapi-file.h b/src/os/inc/osapi-file.h index 011da6872..421b64442 100644 --- a/src/os/inc/osapi-file.h +++ b/src/os/inc/osapi-file.h @@ -29,7 +29,6 @@ #include "common_types.h" #include "osapi-clock.h" - /** @defgroup OSFileAccess OSAL File Access Option Defines * @{ */ diff --git a/src/os/inc/osapi-filesys.h b/src/os/inc/osapi-filesys.h index b0f719ce3..e49671b0d 100644 --- a/src/os/inc/osapi-filesys.h +++ b/src/os/inc/osapi-filesys.h @@ -31,7 +31,6 @@ #define OS_CHK_ONLY 0 /**< Unused, API takes bool */ #define OS_REPAIR 1 /**< Unused, API takes bool */ - /** @brief OSAL file system info */ typedef struct { @@ -203,10 +202,10 @@ int32 OS_unmount(const char *mountpoint); * @retval #OS_INVALID_POINTER if name is NULL * @retval #OS_FS_ERR_PATH_TOO_LONG if the name is too long * @retval #OS_ERROR if the OS call failed - * + * * @deprecated Replaced by OS_FileSysStatVolume() - * Value can be obtained by reading the "blocks_free" struct member. - * + * */ int32 OS_fsBlocksFree(const char *name); @@ -227,13 +226,13 @@ int32 OS_fsBlocksFree(const char *name); * @retval #OS_INVALID_POINTER if name is NULL * @retval #OS_FS_ERR_PATH_TOO_LONG if the name is too long * @retval #OS_ERROR if the OS call failed - * - * @deprecated Replaced by OS_FileSysStatVolume(). + * + * @deprecated Replaced by OS_FileSysStatVolume(). * Value can be obtained by multiplying the "blocks_free" by the "block_size" struct members. */ int32 OS_fsBytesFree(const char *name, uint64 *bytes_free); -#endif /* OSAL_OMIT_DEPRECATED */ +#endif /* OSAL_OMIT_DEPRECATED */ /*-------------------------------------------------------------------------------------*/ /** @@ -326,5 +325,4 @@ int32 OS_TranslatePath(const char *VirtualPath, char *LocalPath); int32 OS_GetFsInfo(os_fsinfo_t *filesys_info); /**@}*/ - #endif diff --git a/src/os/inc/osapi-module.h b/src/os/inc/osapi-module.h index c3196e677..d6f60fde6 100644 --- a/src/os/inc/osapi-module.h +++ b/src/os/inc/osapi-module.h @@ -25,7 +25,6 @@ #ifndef OSAPI_MODULE_H #define OSAPI_MODULE_H - #include "osconfig.h" #include "common_types.h" @@ -47,7 +46,7 @@ * to unload the module in the future, if the symbols are in use by other entities. * */ -#define OS_MODULE_FLAG_GLOBAL_SYMBOLS 0x00 +#define OS_MODULE_FLAG_GLOBAL_SYMBOLS 0x00 /** * @brief Requests OS_ModuleLoad() to keep the symbols local/private to this module @@ -69,7 +68,7 @@ * application must ensure that all references obtained in this manner have * been cleaned up/released before unloading the module. */ -#define OS_MODULE_FLAG_LOCAL_SYMBOLS 0x01 +#define OS_MODULE_FLAG_LOCAL_SYMBOLS 0x01 /* ** Typedefs diff --git a/src/os/inc/osapi-mutex.h b/src/os/inc/osapi-mutex.h index b41d9a994..d7ba1664c 100644 --- a/src/os/inc/osapi-mutex.h +++ b/src/os/inc/osapi-mutex.h @@ -28,7 +28,6 @@ #include "osconfig.h" #include "common_types.h" - /** @brief OSAL mutex properties */ typedef struct { diff --git a/src/os/inc/osapi-os-net.h b/src/os/inc/osapi-os-net.h index 3b8c43b84..6b18ca94e 100644 --- a/src/os/inc/osapi-os-net.h +++ b/src/os/inc/osapi-os-net.h @@ -45,5 +45,4 @@ #include "osapi-sockets.h" #include "osapi-network.h" - #endif diff --git a/src/os/inc/osapi-os-timer.h b/src/os/inc/osapi-os-timer.h index 30535bc53..7b27548f3 100644 --- a/src/os/inc/osapi-os-timer.h +++ b/src/os/inc/osapi-os-timer.h @@ -45,5 +45,4 @@ #include "osapi-timebase.h" #include "osapi-timer.h" - #endif diff --git a/src/os/inc/osapi-queue.h b/src/os/inc/osapi-queue.h index 5f989ff80..3bc5a877a 100644 --- a/src/os/inc/osapi-queue.h +++ b/src/os/inc/osapi-queue.h @@ -35,7 +35,6 @@ typedef struct osal_id_t creator; } OS_queue_prop_t; - /** @defgroup OSAPIMsgQueue OSAL Message Queue APIs * @{ */ diff --git a/src/os/inc/osapi-timebase.h b/src/os/inc/osapi-timebase.h index ec038053e..1e709ee2b 100644 --- a/src/os/inc/osapi-timebase.h +++ b/src/os/inc/osapi-timebase.h @@ -31,7 +31,7 @@ /* ** Typedefs */ -typedef uint32 (*OS_TimerSync_t)(osal_id_t timer_id); /**< @brief Timer sync */ +typedef uint32 (*OS_TimerSync_t)(osal_id_t timer_id); /**< @brief Timer sync */ /** @brief Time base properties */ typedef struct diff --git a/src/os/inc/osapi-version.h b/src/os/inc/osapi-version.h index bf0946a61..9923b82c3 100644 --- a/src/os/inc/osapi-version.h +++ b/src/os/inc/osapi-version.h @@ -30,7 +30,7 @@ /* * Development Build Macro Definitions */ -#define OS_BUILD_NUMBER 221 +#define OS_BUILD_NUMBER 262 #define OS_BUILD_BASELINE "v5.1.0-rc1" /* @@ -38,7 +38,9 @@ */ #define OS_MAJOR_VERSION 5 /*!< @brief ONLY APPLY for OFFICIAL releases. Major version number. */ #define OS_MINOR_VERSION 0 /*!< @brief ONLY APPLY for OFFICIAL releases. Minor version number. */ -#define OS_REVISION 99 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision version number. A value of "99" indicates an unreleased development version. */ +#define OS_REVISION \ + 99 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision version number. A value of "99" indicates an unreleased \ + development version. */ #define OS_MISSION_REV 0 /*!< @brief ONLY USED by MISSION Implementations. Mission revision */ @@ -70,7 +72,7 @@ OSAL 4.1 is present. */ #define OSAL_API_VERSION ((OS_MAJOR_VERSION * 10000) + (OS_MINOR_VERSION * 100) + OS_REVISION) -#endif /* OSAPI_VERSION_H */ +#endif /* OSAPI_VERSION_H */ /************************/ /* End of File Comment */ diff --git a/src/os/inc/osapi.h b/src/os/inc/osapi.h index 2d6e11a4b..11701501a 100644 --- a/src/os/inc/osapi.h +++ b/src/os/inc/osapi.h @@ -98,7 +98,6 @@ extern "C" #include "osapi-bsp.h" - #ifdef __cplusplus } #endif diff --git a/src/os/portable/os-impl-bsd-sockets.c b/src/os/portable/os-impl-bsd-sockets.c index 31ca3e911..8b66ca1b1 100644 --- a/src/os/portable/os-impl-bsd-sockets.c +++ b/src/os/portable/os-impl-bsd-sockets.c @@ -126,23 +126,14 @@ int32 OS_SocketOpen_Impl(const OS_object_token_t *token) return OS_ERR_NOT_IMPLEMENTED; } - switch (stream->socket_domain) + /* Only AF_INET* at this point, can add cases if support is expanded */ + switch (stream->socket_type) { - case OS_SocketDomain_INET: - case OS_SocketDomain_INET6: - switch (stream->socket_type) - { - case OS_SocketType_DATAGRAM: - os_proto = IPPROTO_UDP; - break; - case OS_SocketType_STREAM: - os_proto = IPPROTO_TCP; - break; - default: - break; - } + case OS_SocketType_DATAGRAM: + os_proto = IPPROTO_UDP; break; - default: + case OS_SocketType_STREAM: + os_proto = IPPROTO_TCP; break; } diff --git a/src/os/portable/os-impl-no-sockets.c b/src/os/portable/os-impl-no-sockets.c index 4ccc9a765..8a4befeda 100644 --- a/src/os/portable/os-impl-no-sockets.c +++ b/src/os/portable/os-impl-no-sockets.c @@ -42,157 +42,124 @@ ***************************************************************************************/ /*---------------------------------------------------------------- + * Implementation for no network configuration * - * Function: OS_SocketOpen_Impl - * - * Purpose: Implemented per internal OSAL API - * See prototype for argument/return detail - * + * See prototype for argument/return detail *-----------------------------------------------------------------*/ -int32 OS_SocketOpen_Impl(uint32 sock_id) +int32 OS_SocketOpen_Impl(const OS_object_token_t *token) { return OS_ERR_NOT_IMPLEMENTED; -} /* end OS_SocketOpen_Impl */ +} /*---------------------------------------------------------------- + * Implementation for no network configuration * - * Function: OS_SocketBind_Impl - * - * Purpose: Implemented per internal OSAL API - * See prototype for argument/return detail - * + * See prototype for argument/return detail *-----------------------------------------------------------------*/ -int32 OS_SocketBind_Impl(uint32 sock_id, const OS_SockAddr_t *Addr) +int32 OS_SocketBind_Impl(const OS_object_token_t *token, const OS_SockAddr_t *Addr) { return OS_ERR_NOT_IMPLEMENTED; -} /* end OS_SocketBind_Impl */ +} /*---------------------------------------------------------------- + * Implementation for no network configuration * - * Function: OS_SocketConnect_Impl - * - * Purpose: Implemented per internal OSAL API - * See prototype for argument/return detail - * + * See prototype for argument/return detail *-----------------------------------------------------------------*/ -int32 OS_SocketConnect_Impl(uint32 sock_id, const OS_SockAddr_t *Addr, int32 timeout) +int32 OS_SocketConnect_Impl(const OS_object_token_t *token, const OS_SockAddr_t *Addr, int32 timeout) { return OS_ERR_NOT_IMPLEMENTED; -} /* end OS_SocketConnect_Impl */ +} /*---------------------------------------------------------------- + * Implementation for no network configuration * - * Function: OS_SocketAccept_Impl - * - * Purpose: Implemented per internal OSAL API - * See prototype for argument/return detail - * + * See prototype for argument/return detail *-----------------------------------------------------------------*/ -int32 OS_SocketAccept_Impl(uint32 sock_id, uint32 connsock_id, OS_SockAddr_t *Addr, int32 timeout) +int32 OS_SocketAccept_Impl(const OS_object_token_t *sock_token, const OS_object_token_t *conn_token, + OS_SockAddr_t *Addr, int32 timeout) { return OS_ERR_NOT_IMPLEMENTED; -} /* end OS_SocketAccept_Impl */ +} /*---------------------------------------------------------------- + * Implementation for no network configuration * - * Function: OS_SocketRecvFrom_Impl - * - * Purpose: Implemented per internal OSAL API - * See prototype for argument/return detail - * + * See prototype for argument/return detail *-----------------------------------------------------------------*/ -int32 OS_SocketRecvFrom_Impl(uint32 sock_id, void *buffer, size_t buflen, OS_SockAddr_t *RemoteAddr, int32 timeout) +int32 OS_SocketRecvFrom_Impl(const OS_object_token_t *token, void *buffer, size_t buflen, OS_SockAddr_t *RemoteAddr, + int32 timeout) { return OS_ERR_NOT_IMPLEMENTED; -} /* end OS_SocketRecvFrom_Impl */ +} /*---------------------------------------------------------------- + * Implementation for no network configuration * - * Function: OS_SocketSendTo_Impl - * - * Purpose: Implemented per internal OSAL API - * See prototype for argument/return detail - * + * See prototype for argument/return detail *-----------------------------------------------------------------*/ -int32 OS_SocketSendTo_Impl(uint32 sock_id, const void *buffer, size_t buflen, const OS_SockAddr_t *RemoteAddr) +int32 OS_SocketSendTo_Impl(const OS_object_token_t *token, const void *buffer, size_t buflen, + const OS_SockAddr_t *RemoteAddr) { return OS_ERR_NOT_IMPLEMENTED; -} /* end OS_SocketSendTo_Impl */ +} /*---------------------------------------------------------------- + * Implementation for no network configuration * - * Function: OS_SocketGetInfo_Impl - * - * Purpose: Implemented per internal OSAL API - * See prototype for argument/return detail - * + * See prototype for argument/return detail *-----------------------------------------------------------------*/ -int32 OS_SocketGetInfo_Impl(uint32 sock_id, OS_socket_prop_t *sock_prop) +int32 OS_SocketGetInfo_Impl(const OS_object_token_t *token, OS_socket_prop_t *sock_prop) { return OS_SUCCESS; -} /* end OS_SocketGetInfo_Impl */ +} /*---------------------------------------------------------------- + * Implementation for no network configuration * - * Function: OS_SocketAddrInit_Impl - * - * Purpose: Implemented per internal OSAL API - * See prototype for argument/return detail - * + * See prototype for argument/return detail *-----------------------------------------------------------------*/ int32 OS_SocketAddrInit_Impl(OS_SockAddr_t *Addr, OS_SocketDomain_t Domain) { return OS_ERR_NOT_IMPLEMENTED; -} /* end OS_SocketAddrInit_Impl */ +} /*---------------------------------------------------------------- + * Implementation for no network configuration * - * Function: OS_SocketAddrToString_Impl - * - * Purpose: Implemented per internal OSAL API - * See prototype for argument/return detail - * + * See prototype for argument/return detail *-----------------------------------------------------------------*/ -int32 OS_SocketAddrToString_Impl(char *buffer, uint32 buflen, const OS_SockAddr_t *Addr) +int32 OS_SocketAddrToString_Impl(char *buffer, size_t buflen, const OS_SockAddr_t *Addr) { return OS_ERR_NOT_IMPLEMENTED; -} /* end OS_SocketAddrToString_Impl */ +} /*---------------------------------------------------------------- + * Implementation for no network configuration * - * Function: OS_SocketAddrFromString_Impl - * - * Purpose: Implemented per internal OSAL API - * See prototype for argument/return detail - * + * See prototype for argument/return detail *-----------------------------------------------------------------*/ int32 OS_SocketAddrFromString_Impl(OS_SockAddr_t *Addr, const char *string) { return OS_ERR_NOT_IMPLEMENTED; -} /* end OS_SocketAddrFromString_Impl */ +} /*---------------------------------------------------------------- + * Implementation for no network configuration * - * Function: OS_SocketAddrGetPort_Impl - * - * Purpose: Implemented per internal OSAL API - * See prototype for argument/return detail - * + * See prototype for argument/return detail *-----------------------------------------------------------------*/ int32 OS_SocketAddrGetPort_Impl(uint16 *PortNum, const OS_SockAddr_t *Addr) { return OS_ERR_NOT_IMPLEMENTED; -} /* end OS_SocketAddrGetPort_Impl */ +} /*---------------------------------------------------------------- + * Implementation for no network configuration * - * Function: OS_SocketAddrSetPort_Impl - * - * Purpose: Implemented per internal OSAL API - * See prototype for argument/return detail - * + * See prototype for argument/return detail *-----------------------------------------------------------------*/ int32 OS_SocketAddrSetPort_Impl(OS_SockAddr_t *Addr, uint16 PortNum) { return OS_ERR_NOT_IMPLEMENTED; -} /* end OS_SocketAddrSetPort_Impl */ +} diff --git a/src/os/portable/os-impl-no-symtab.c b/src/os/portable/os-impl-no-symtab.c index 3af60dfa4..270fd598d 100644 --- a/src/os/portable/os-impl-no-symtab.c +++ b/src/os/portable/os-impl-no-symtab.c @@ -31,43 +31,31 @@ #include "os-shared-module.h" /*---------------------------------------------------------------- + * Implementation for no dynamic loader configuration * - * Function: OS_GlobalSymbolLookup_Impl - * - * Purpose: Implemented per internal OSAL API - * See prototype for argument/return detail - * + * See prototype for argument/return detail *-----------------------------------------------------------------*/ int32 OS_GlobalSymbolLookup_Impl(cpuaddr *SymbolAddress, const char *SymbolName) { return OS_ERR_NOT_IMPLEMENTED; - -} /* end OS_GlobalSymbolLookup_Impl */ +} /*---------------------------------------------------------------- + * Implementation for no dynamic loader configuration * - * Function: OS_ModuleSymbolLookup_Impl - * - * Purpose: Implemented per internal OSAL API - * See prototype for argument/return detail - * + * See prototype for argument/return detail *-----------------------------------------------------------------*/ -int32 OS_ModuleSymbolLookup_Impl(uint32 local_id, cpuaddr *SymbolAddress, const char *SymbolName) +int32 OS_ModuleSymbolLookup_Impl(const OS_object_token_t *token, cpuaddr *SymbolAddress, const char *SymbolName) { return OS_ERR_NOT_IMPLEMENTED; - -} /* end OS_ModuleSymbolLookup_Impl */ +} /*---------------------------------------------------------------- + * Implementation for no dynamic loader configuration * - * Function: OS_SymbolTableDump_Impl - * - * Purpose: Implemented per internal OSAL API - * See prototype for argument/return detail - * + * See prototype for argument/return detail *-----------------------------------------------------------------*/ int32 OS_SymbolTableDump_Impl(const char *filename, size_t SizeLimit) { return (OS_ERR_NOT_IMPLEMENTED); - -} /* end OS_SymbolTableDump_Impl */ +} diff --git a/src/os/posix/inc/os-impl-binsem.h b/src/os/posix/inc/os-impl-binsem.h index d55f3e165..356ec8e94 100644 --- a/src/os/posix/inc/os-impl-binsem.h +++ b/src/os/posix/inc/os-impl-binsem.h @@ -44,4 +44,4 @@ typedef struct /* Tables where the OS object information is stored */ extern OS_impl_binsem_internal_record_t OS_impl_bin_sem_table[OS_MAX_BIN_SEMAPHORES]; -#endif /* OS_IMPL_BINSEM_H */ +#endif /* OS_IMPL_BINSEM_H */ diff --git a/src/os/posix/inc/os-impl-console.h b/src/os/posix/inc/os-impl-console.h index eb92465e3..3ed7ac81f 100644 --- a/src/os/posix/inc/os-impl-console.h +++ b/src/os/posix/inc/os-impl-console.h @@ -42,4 +42,4 @@ typedef struct extern OS_impl_console_internal_record_t OS_impl_console_table[OS_MAX_CONSOLES]; -#endif /* OS_IMPL_CONSOLE_H */ +#endif /* OS_IMPL_CONSOLE_H */ diff --git a/src/os/posix/inc/os-impl-countsem.h b/src/os/posix/inc/os-impl-countsem.h index d6ee39a75..176fcd9ec 100644 --- a/src/os/posix/inc/os-impl-countsem.h +++ b/src/os/posix/inc/os-impl-countsem.h @@ -39,4 +39,4 @@ typedef struct /* Tables where the OS object information is stored */ extern OS_impl_countsem_internal_record_t OS_impl_count_sem_table[OS_MAX_COUNT_SEMAPHORES]; -#endif /* OS_IMPL_COUNTSEM_H */ +#endif /* OS_IMPL_COUNTSEM_H */ diff --git a/src/os/posix/inc/os-impl-dirs.h b/src/os/posix/inc/os-impl-dirs.h index 981f3530b..e10b8e185 100644 --- a/src/os/posix/inc/os-impl-dirs.h +++ b/src/os/posix/inc/os-impl-dirs.h @@ -45,4 +45,4 @@ typedef struct */ extern OS_impl_dir_internal_record_t OS_impl_dir_table[OS_MAX_NUM_OPEN_DIRS]; -#endif /* OS_IMPL_DIRS_H */ +#endif /* OS_IMPL_DIRS_H */ diff --git a/src/os/posix/inc/os-impl-files.h b/src/os/posix/inc/os-impl-files.h index df01c5b23..ec9f1e01c 100644 --- a/src/os/posix/inc/os-impl-files.h +++ b/src/os/posix/inc/os-impl-files.h @@ -48,4 +48,4 @@ extern gid_t OS_IMPL_SELF_EGID; extern const int OS_IMPL_REGULAR_FILE_FLAGS; -#endif /* OS_IMPL_FILES_H */ +#endif /* OS_IMPL_FILES_H */ diff --git a/src/os/posix/inc/os-impl-gettime.h b/src/os/posix/inc/os-impl-gettime.h index 308d3b4d8..c48d6f324 100644 --- a/src/os/posix/inc/os-impl-gettime.h +++ b/src/os/posix/inc/os-impl-gettime.h @@ -33,4 +33,4 @@ #define OSAL_GETTIME_SOURCE_CLOCK CLOCK_MONOTONIC -#endif /* OS_IMPL_GETTIME_H */ +#endif /* OS_IMPL_GETTIME_H */ diff --git a/src/os/posix/inc/os-impl-idmap.h b/src/os/posix/inc/os-impl-idmap.h index fcedf13ef..00194e1ac 100644 --- a/src/os/posix/inc/os-impl-idmap.h +++ b/src/os/posix/inc/os-impl-idmap.h @@ -41,4 +41,4 @@ typedef struct /* Tables where the lock state information is stored */ extern OS_impl_objtype_lock_t *const OS_impl_objtype_lock_table[OS_OBJECT_TYPE_USER]; -#endif /* OS_IMPL_IDMAP_H */ +#endif /* OS_IMPL_IDMAP_H */ diff --git a/src/os/posix/inc/os-impl-io.h b/src/os/posix/inc/os-impl-io.h index 80a67119b..9db8e7c81 100644 --- a/src/os/posix/inc/os-impl-io.h +++ b/src/os/posix/inc/os-impl-io.h @@ -48,4 +48,4 @@ typedef struct */ extern OS_impl_file_internal_record_t OS_impl_filehandle_table[OS_MAX_NUM_OPEN_FILES]; -#endif /* OS_IMPL_IO_H */ +#endif /* OS_IMPL_IO_H */ diff --git a/src/os/posix/inc/os-impl-loader.h b/src/os/posix/inc/os-impl-loader.h index 3fbfb00b5..b7dc4b641 100644 --- a/src/os/posix/inc/os-impl-loader.h +++ b/src/os/posix/inc/os-impl-loader.h @@ -52,4 +52,4 @@ typedef struct */ extern OS_impl_module_internal_record_t OS_impl_module_table[OS_MAX_MODULES]; -#endif /* OS_IMPL_LOADER_H */ +#endif /* OS_IMPL_LOADER_H */ diff --git a/src/os/posix/inc/os-impl-mutex.h b/src/os/posix/inc/os-impl-mutex.h index c286b0c10..61db43dbf 100644 --- a/src/os/posix/inc/os-impl-mutex.h +++ b/src/os/posix/inc/os-impl-mutex.h @@ -40,4 +40,4 @@ typedef struct /* Tables where the OS object information is stored */ extern OS_impl_mutex_internal_record_t OS_impl_mutex_table[OS_MAX_MUTEXES]; -#endif /* OS_IMPL_MUTEX_H */ +#endif /* OS_IMPL_MUTEX_H */ diff --git a/src/os/posix/inc/os-impl-network.h b/src/os/posix/inc/os-impl-network.h index eaa507cff..977f978d6 100644 --- a/src/os/posix/inc/os-impl-network.h +++ b/src/os/posix/inc/os-impl-network.h @@ -30,4 +30,4 @@ #include -#endif /* OS_IMPL_NETWORK_H */ +#endif /* OS_IMPL_NETWORK_H */ diff --git a/src/os/posix/inc/os-impl-queues.h b/src/os/posix/inc/os-impl-queues.h index f94091183..673b6a0a0 100644 --- a/src/os/posix/inc/os-impl-queues.h +++ b/src/os/posix/inc/os-impl-queues.h @@ -40,4 +40,4 @@ typedef struct /* Tables where the OS object information is stored */ extern OS_impl_queue_internal_record_t OS_impl_queue_table[OS_MAX_QUEUES]; -#endif /* OS_IMPL_QUEUES_H */ +#endif /* OS_IMPL_QUEUES_H */ diff --git a/src/os/posix/inc/os-impl-select.h b/src/os/posix/inc/os-impl-select.h index 13d299397..bdcdc9ba0 100644 --- a/src/os/posix/inc/os-impl-select.h +++ b/src/os/posix/inc/os-impl-select.h @@ -33,4 +33,4 @@ #include #include -#endif /* OS_IMPL_SELECT_H */ +#endif /* OS_IMPL_SELECT_H */ diff --git a/src/os/posix/inc/os-impl-sockets.h b/src/os/posix/inc/os-impl-sockets.h index 7911c9ddc..217253246 100644 --- a/src/os/posix/inc/os-impl-sockets.h +++ b/src/os/posix/inc/os-impl-sockets.h @@ -43,4 +43,4 @@ */ #define OS_IMPL_SOCKET_FLAGS O_NONBLOCK -#endif /* OS_IMPL_SOCKETS_H */ +#endif /* OS_IMPL_SOCKETS_H */ diff --git a/src/os/posix/inc/os-impl-tasks.h b/src/os/posix/inc/os-impl-tasks.h index d73d3628f..da25cd0ea 100644 --- a/src/os/posix/inc/os-impl-tasks.h +++ b/src/os/posix/inc/os-impl-tasks.h @@ -45,5 +45,4 @@ extern OS_impl_task_internal_record_t OS_impl_task_table[OS_MAX_TASKS]; int32 OS_Posix_InternalTaskCreate_Impl(pthread_t *pthr, osal_priority_t priority, size_t stacksz, PthreadFuncPtr_t entry, void *entry_arg); - -#endif /* OS_IMPL_TASKS_H */ +#endif /* OS_IMPL_TASKS_H */ diff --git a/src/os/posix/inc/os-impl-timebase.h b/src/os/posix/inc/os-impl-timebase.h index 103b78911..a995f4b8b 100644 --- a/src/os/posix/inc/os-impl-timebase.h +++ b/src/os/posix/inc/os-impl-timebase.h @@ -50,4 +50,4 @@ typedef struct extern OS_impl_timebase_internal_record_t OS_impl_timebase_table[OS_MAX_TIMEBASES]; -#endif /* OS_IMPL_TIMEBASE_H */ +#endif /* OS_IMPL_TIMEBASE_H */ diff --git a/src/os/posix/inc/os-posix.h b/src/os/posix/inc/os-posix.h index d05d4ac5b..9c2c1d2c9 100644 --- a/src/os/posix/inc/os-posix.h +++ b/src/os/posix/inc/os-posix.h @@ -107,6 +107,6 @@ int32 OS_Posix_FileSysAPI_Impl_Init(void); int32 OS_Posix_TableMutex_Init(osal_objtype_t idtype); -void OS_Posix_CompAbsDelayTime(uint32 msecs, struct timespec *tm); +void OS_Posix_CompAbsDelayTime(uint32 msecs, struct timespec *tm); -#endif /* OS_POSIX_H */ +#endif /* OS_POSIX_H */ diff --git a/src/os/posix/src/os-impl-binsem.c b/src/os/posix/src/os-impl-binsem.c index fe86c4b8a..42999931a 100644 --- a/src/os/posix/src/os-impl-binsem.c +++ b/src/os/posix/src/os-impl-binsem.c @@ -198,6 +198,17 @@ int32 OS_BinSemCreate_Impl(const OS_object_token_t *token, uint32 initial_value, cond_created = 1; + /* + * Check sem call, avoids unreachable destroy logic + */ + ret = pthread_cond_signal(&(sem->cv)); + if (ret != 0) + { + OS_DEBUG("Error: initial pthread_cond_signal failed: %s\n", strerror(ret)); + return_code = OS_SEM_FAILURE; + break; + } + /* ** fill out the proper OSAL table fields */ diff --git a/src/os/posix/src/os-impl-idmap.c b/src/os/posix/src/os-impl-idmap.c index 2ec48dda3..60c7ce0c2 100644 --- a/src/os/posix/src/os-impl-idmap.c +++ b/src/os/posix/src/os-impl-idmap.c @@ -49,8 +49,7 @@ static OS_impl_objtype_lock_t OS_module_table_lock; static OS_impl_objtype_lock_t OS_filesys_table_lock; static OS_impl_objtype_lock_t OS_console_lock; -OS_impl_objtype_lock_t * const OS_impl_objtype_lock_table[OS_OBJECT_TYPE_USER] = -{ +OS_impl_objtype_lock_t *const OS_impl_objtype_lock_table[OS_OBJECT_TYPE_USER] = { [OS_OBJECT_TYPE_UNDEFINED] = NULL, [OS_OBJECT_TYPE_OS_TASK] = &OS_global_task_table_lock, [OS_OBJECT_TYPE_OS_QUEUE] = &OS_queue_table_lock, @@ -86,7 +85,7 @@ void OS_Posix_ReleaseTableMutex(void *mut) void OS_Lock_Global_Impl(osal_objtype_t idtype) { OS_impl_objtype_lock_t *impl; - int ret; + int ret; impl = OS_impl_objtype_lock_table[idtype]; @@ -109,7 +108,7 @@ void OS_Lock_Global_Impl(osal_objtype_t idtype) void OS_Unlock_Global_Impl(osal_objtype_t idtype) { OS_impl_objtype_lock_t *impl; - int ret; + int ret; impl = OS_impl_objtype_lock_table[idtype]; @@ -140,7 +139,7 @@ void OS_Unlock_Global_Impl(osal_objtype_t idtype) void OS_WaitForStateChange_Impl(osal_objtype_t idtype, uint32 attempts) { OS_impl_objtype_lock_t *impl; - struct timespec ts; + struct timespec ts; impl = OS_impl_objtype_lock_table[idtype]; @@ -183,9 +182,9 @@ void OS_WaitForStateChange_Impl(osal_objtype_t idtype, uint32 attempts) ---------------------------------------------------------------------------------------*/ int32 OS_Posix_TableMutex_Init(osal_objtype_t idtype) { - int ret; - int32 return_code = OS_SUCCESS; - pthread_mutexattr_t mutex_attr; + int ret; + int32 return_code = OS_SUCCESS; + pthread_mutexattr_t mutex_attr; OS_impl_objtype_lock_t *impl; impl = OS_impl_objtype_lock_table[idtype]; diff --git a/src/os/posix/src/os-impl-tasks.c b/src/os/posix/src/os-impl-tasks.c index 5fd06e8bf..bf1761772 100644 --- a/src/os/posix/src/os-impl-tasks.c +++ b/src/os/posix/src/os-impl-tasks.c @@ -421,8 +421,8 @@ int32 OS_Posix_TaskAPI_Impl_Init(void) ret_long = sysconf(_SC_PAGESIZE); if (ret_long < 0) { - OS_DEBUG("Could not get page size via sysconf: %s\n", strerror(errno)); - return OS_ERROR; + OS_DEBUG("Could not get page size via sysconf: %s\n", strerror(errno)); + return OS_ERROR; } POSIX_GlobalVars.PageSize = ret_long; diff --git a/src/os/posix/src/os-impl-timebase.c b/src/os/posix/src/os-impl-timebase.c index 87828730b..669f17e7e 100644 --- a/src/os/posix/src/os-impl-timebase.c +++ b/src/os/posix/src/os-impl-timebase.c @@ -302,8 +302,8 @@ int32 OS_Posix_TimeBaseAPI_Impl_Init(void) * - This is used internally for reporting accuracy, * - TicksPerSecond values over 2M will return zero */ - OS_SharedGlobalVars.MicroSecPerTick = (1000000 + (OS_SharedGlobalVars.TicksPerSecond / 2)) / - OS_SharedGlobalVars.TicksPerSecond; + OS_SharedGlobalVars.MicroSecPerTick = + (1000000 + (OS_SharedGlobalVars.TicksPerSecond / 2)) / OS_SharedGlobalVars.TicksPerSecond; } while (0); return (return_code); diff --git a/src/os/rtems/inc/os-impl-binsem.h b/src/os/rtems/inc/os-impl-binsem.h index 4af72c46c..7437e6c5b 100644 --- a/src/os/rtems/inc/os-impl-binsem.h +++ b/src/os/rtems/inc/os-impl-binsem.h @@ -39,4 +39,4 @@ typedef struct /* Tables where the OS object information is stored */ extern OS_impl_binsem_internal_record_t OS_impl_bin_sem_table[OS_MAX_BIN_SEMAPHORES]; -#endif /* OS_IMPL_BINSEM_H */ +#endif /* OS_IMPL_BINSEM_H */ diff --git a/src/os/rtems/inc/os-impl-console.h b/src/os/rtems/inc/os-impl-console.h index adcaa49dd..03663aad9 100644 --- a/src/os/rtems/inc/os-impl-console.h +++ b/src/os/rtems/inc/os-impl-console.h @@ -42,4 +42,4 @@ typedef struct extern OS_impl_console_internal_record_t OS_impl_console_table[OS_MAX_CONSOLES]; -#endif /* OS_IMPL_CONSOLE_H */ +#endif /* OS_IMPL_CONSOLE_H */ diff --git a/src/os/rtems/inc/os-impl-countsem.h b/src/os/rtems/inc/os-impl-countsem.h index a992d62e6..5070ee6db 100644 --- a/src/os/rtems/inc/os-impl-countsem.h +++ b/src/os/rtems/inc/os-impl-countsem.h @@ -39,4 +39,4 @@ typedef struct /* Tables where the OS object information is stored */ extern OS_impl_countsem_internal_record_t OS_impl_count_sem_table[OS_MAX_COUNT_SEMAPHORES]; -#endif /* OS_IMPL_COUNTSEM_H */ +#endif /* OS_IMPL_COUNTSEM_H */ diff --git a/src/os/rtems/inc/os-impl-dirs.h b/src/os/rtems/inc/os-impl-dirs.h index e7f7d073f..8db0eee60 100644 --- a/src/os/rtems/inc/os-impl-dirs.h +++ b/src/os/rtems/inc/os-impl-dirs.h @@ -45,4 +45,4 @@ typedef struct */ extern OS_impl_dir_internal_record_t OS_impl_dir_table[OS_MAX_NUM_OPEN_DIRS]; -#endif /* OS_IMPL_DIRS_H */ +#endif /* OS_IMPL_DIRS_H */ diff --git a/src/os/rtems/inc/os-impl-files.h b/src/os/rtems/inc/os-impl-files.h index 5b58da49a..c15b915b6 100644 --- a/src/os/rtems/inc/os-impl-files.h +++ b/src/os/rtems/inc/os-impl-files.h @@ -42,4 +42,4 @@ #define OS_IMPL_REGULAR_FILE_FLAGS 0 -#endif /* OS_IMPL_FILES_H */ +#endif /* OS_IMPL_FILES_H */ diff --git a/src/os/rtems/inc/os-impl-gettime.h b/src/os/rtems/inc/os-impl-gettime.h index 5b3b8237c..28690e350 100644 --- a/src/os/rtems/inc/os-impl-gettime.h +++ b/src/os/rtems/inc/os-impl-gettime.h @@ -33,4 +33,4 @@ #define OSAL_GETTIME_SOURCE_CLOCK CLOCK_MONOTONIC -#endif /* OS_IMPL_GETTIME_H */ +#endif /* OS_IMPL_GETTIME_H */ diff --git a/src/os/rtems/inc/os-impl-idmap.h b/src/os/rtems/inc/os-impl-idmap.h index c953afbcf..1f0285192 100644 --- a/src/os/rtems/inc/os-impl-idmap.h +++ b/src/os/rtems/inc/os-impl-idmap.h @@ -40,4 +40,4 @@ typedef struct /* Tables where the lock state information is stored */ extern OS_impl_objtype_lock_t *const OS_impl_objtype_lock_table[OS_OBJECT_TYPE_USER]; -#endif /* OS_IMPL_IDMAP_H */ +#endif /* OS_IMPL_IDMAP_H */ diff --git a/src/os/rtems/inc/os-impl-io.h b/src/os/rtems/inc/os-impl-io.h index 3ad2aa372..da6432214 100644 --- a/src/os/rtems/inc/os-impl-io.h +++ b/src/os/rtems/inc/os-impl-io.h @@ -46,4 +46,4 @@ typedef struct */ extern OS_impl_file_internal_record_t OS_impl_filehandle_table[OS_MAX_NUM_OPEN_FILES]; -#endif /* OS_IMPL_IO_H */ +#endif /* OS_IMPL_IO_H */ diff --git a/src/os/rtems/inc/os-impl-loader.h b/src/os/rtems/inc/os-impl-loader.h index 126899e34..12503c023 100644 --- a/src/os/rtems/inc/os-impl-loader.h +++ b/src/os/rtems/inc/os-impl-loader.h @@ -50,4 +50,4 @@ typedef struct extern OS_impl_module_internal_record_t OS_impl_module_table[OS_MAX_MODULES]; -#endif /* OS_IMPL_LOADER_H */ +#endif /* OS_IMPL_LOADER_H */ diff --git a/src/os/rtems/inc/os-impl-mutex.h b/src/os/rtems/inc/os-impl-mutex.h index d59896874..be17d462a 100644 --- a/src/os/rtems/inc/os-impl-mutex.h +++ b/src/os/rtems/inc/os-impl-mutex.h @@ -39,4 +39,4 @@ typedef struct /* Tables where the OS object information is stored */ extern OS_impl_mutex_internal_record_t OS_impl_mutex_table[OS_MAX_MUTEXES]; -#endif /* OS_IMPL_MUTEX_H */ +#endif /* OS_IMPL_MUTEX_H */ diff --git a/src/os/rtems/inc/os-impl-queues.h b/src/os/rtems/inc/os-impl-queues.h index 38542793b..354abec24 100644 --- a/src/os/rtems/inc/os-impl-queues.h +++ b/src/os/rtems/inc/os-impl-queues.h @@ -39,4 +39,4 @@ typedef struct /* Tables where the OS object information is stored */ extern OS_impl_queue_internal_record_t OS_impl_queue_table[OS_MAX_QUEUES]; -#endif /* OS_IMPL_QUEUES_H */ +#endif /* OS_IMPL_QUEUES_H */ diff --git a/src/os/rtems/inc/os-impl-select.h b/src/os/rtems/inc/os-impl-select.h index a4591dd76..4e6164365 100644 --- a/src/os/rtems/inc/os-impl-select.h +++ b/src/os/rtems/inc/os-impl-select.h @@ -33,4 +33,4 @@ #include #include -#endif /* OS_IMPL_SELECT_H */ +#endif /* OS_IMPL_SELECT_H */ diff --git a/src/os/rtems/inc/os-impl-sockets.h b/src/os/rtems/inc/os-impl-sockets.h index 286e37873..a1e557801 100644 --- a/src/os/rtems/inc/os-impl-sockets.h +++ b/src/os/rtems/inc/os-impl-sockets.h @@ -43,4 +43,4 @@ */ #define OS_IMPL_SOCKET_FLAGS O_NONBLOCK -#endif /* OS_IMPL_SOCKETS_H */ +#endif /* OS_IMPL_SOCKETS_H */ diff --git a/src/os/rtems/inc/os-impl-tasks.h b/src/os/rtems/inc/os-impl-tasks.h index 491a8c1b2..d8fb5dd47 100644 --- a/src/os/rtems/inc/os-impl-tasks.h +++ b/src/os/rtems/inc/os-impl-tasks.h @@ -39,4 +39,4 @@ typedef struct /* Tables where the OS object information is stored */ extern OS_impl_task_internal_record_t OS_impl_task_table[OS_MAX_TASKS]; -#endif /* OS_IMPL_TASKS_H */ +#endif /* OS_IMPL_TASKS_H */ diff --git a/src/os/rtems/inc/os-impl-timebase.h b/src/os/rtems/inc/os-impl-timebase.h index 747f74ce0..998d6354f 100644 --- a/src/os/rtems/inc/os-impl-timebase.h +++ b/src/os/rtems/inc/os-impl-timebase.h @@ -50,4 +50,4 @@ typedef struct extern OS_impl_timebase_internal_record_t OS_impl_timebase_table[OS_MAX_TIMEBASES]; -#endif /* OS_IMPL_TIMEBASE_H */ +#endif /* OS_IMPL_TIMEBASE_H */ diff --git a/src/os/rtems/inc/os-rtems.h b/src/os/rtems/inc/os-rtems.h index 2514bdf53..b901f3911 100644 --- a/src/os/rtems/inc/os-rtems.h +++ b/src/os/rtems/inc/os-rtems.h @@ -56,15 +56,15 @@ * Handle the data structure and API name changes between RTEMS 4.11 and RTEMS 5.1 */ #ifdef _RTEMS_5_ - #define OSAL_HEAP_INFO_BLOCK Heap_Information_block - #define OSAL_UNRESOLV_REC_TYPE rtems_rtl_unresolv_rec - #define OSAL_UNRESOLVED_SYMBOL rtems_rtl_unresolved_symbol - #define OSAL_UNRESOLVED_ITERATE rtems_rtl_unresolved_iterate +#define OSAL_HEAP_INFO_BLOCK Heap_Information_block +#define OSAL_UNRESOLV_REC_TYPE rtems_rtl_unresolv_rec +#define OSAL_UNRESOLVED_SYMBOL rtems_rtl_unresolved_symbol +#define OSAL_UNRESOLVED_ITERATE rtems_rtl_unresolved_iterate #else - #define OSAL_HEAP_INFO_BLOCK region_information_block - #define OSAL_UNRESOLV_REC_TYPE rtems_rtl_unresolv_rec_t - #define OSAL_UNRESOLVED_SYMBOL rtems_rtl_unresolved_name - #define OSAL_UNRESOLVED_ITERATE rtems_rtl_unresolved_interate +#define OSAL_HEAP_INFO_BLOCK region_information_block +#define OSAL_UNRESOLV_REC_TYPE rtems_rtl_unresolv_rec_t +#define OSAL_UNRESOLVED_SYMBOL rtems_rtl_unresolved_name +#define OSAL_UNRESOLVED_ITERATE rtems_rtl_unresolved_interate #endif /**************************************************************************************** @@ -100,4 +100,4 @@ int32 OS_Rtems_FileSysAPI_Impl_Init(void); int32 OS_Rtems_TableMutex_Init(osal_objtype_t idtype); -#endif /* OS_RTEMS_H */ +#endif /* OS_RTEMS_H */ diff --git a/src/os/rtems/src/os-impl-idmap.c b/src/os/rtems/src/os-impl-idmap.c index 340cc9fc0..cdce72602 100644 --- a/src/os/rtems/src/os-impl-idmap.c +++ b/src/os/rtems/src/os-impl-idmap.c @@ -58,8 +58,7 @@ static OS_impl_objtype_lock_t OS_module_table_lock; static OS_impl_objtype_lock_t OS_filesys_table_lock; static OS_impl_objtype_lock_t OS_console_lock; -OS_impl_objtype_lock_t *const OS_impl_objtype_lock_table[OS_OBJECT_TYPE_USER] = -{ +OS_impl_objtype_lock_t *const OS_impl_objtype_lock_table[OS_OBJECT_TYPE_USER] = { [OS_OBJECT_TYPE_UNDEFINED] = NULL, [OS_OBJECT_TYPE_OS_TASK] = &OS_task_table_lock, [OS_OBJECT_TYPE_OS_QUEUE] = &OS_queue_table_lock, @@ -86,7 +85,7 @@ OS_impl_objtype_lock_t *const OS_impl_objtype_lock_table[OS_OBJECT_TYPE_USER] = void OS_Lock_Global_Impl(osal_objtype_t idtype) { OS_impl_objtype_lock_t *impl; - rtems_status_code rtems_sc; + rtems_status_code rtems_sc; impl = OS_impl_objtype_lock_table[idtype]; @@ -109,7 +108,7 @@ void OS_Lock_Global_Impl(osal_objtype_t idtype) void OS_Unlock_Global_Impl(osal_objtype_t idtype) { OS_impl_objtype_lock_t *impl; - rtems_status_code rtems_sc; + rtems_status_code rtems_sc; impl = OS_impl_objtype_lock_table[idtype]; @@ -162,7 +161,7 @@ void OS_WaitForStateChange_Impl(osal_objtype_t idtype, uint32 attempts) int32 OS_Rtems_TableMutex_Init(osal_objtype_t idtype) { OS_impl_objtype_lock_t *impl; - rtems_status_code rtems_sc; + rtems_status_code rtems_sc; impl = OS_impl_objtype_lock_table[idtype]; if (impl == NULL) diff --git a/src/os/rtems/src/os-impl-queues.c b/src/os/rtems/src/os-impl-queues.c index 014e9e9ba..2e8ec2188 100644 --- a/src/os/rtems/src/os-impl-queues.c +++ b/src/os/rtems/src/os-impl-queues.c @@ -101,9 +101,9 @@ int32 OS_QueueCreate_Impl(const OS_object_token_t *token, uint32 flags) ** (RTEMS_FIFO or RTEMS_PRIORITY) is irrelevant since only one task waits ** on each queue. */ - status = rtems_message_queue_create(r_name, /* 32-bit RTEMS object name; not used */ - queue->max_depth, /* maximum number of messages in queue (queue depth) */ - queue->max_size, /* maximum size in bytes of a message */ + status = rtems_message_queue_create(r_name, /* 32-bit RTEMS object name; not used */ + queue->max_depth, /* maximum number of messages in queue (queue depth) */ + queue->max_size, /* maximum size in bytes of a message */ RTEMS_FIFO | RTEMS_LOCAL, /* attributes (default) */ &(impl->id) /* object ID returned for queue */ ); diff --git a/src/os/rtems/src/os-impl-timebase.c b/src/os/rtems/src/os-impl-timebase.c index 75bc531aa..321b02109 100644 --- a/src/os/rtems/src/os-impl-timebase.c +++ b/src/os/rtems/src/os-impl-timebase.c @@ -235,8 +235,8 @@ int32 OS_Rtems_TimeBaseAPI_Impl_Init(void) * This really should be an exact/whole number result; otherwise this * will round to the nearest nanosecond. */ - RTEMS_GlobalVars.ClockAccuracyNsec = (1000000000 + (OS_SharedGlobalVars.TicksPerSecond / 2)) / - OS_SharedGlobalVars.TicksPerSecond; + RTEMS_GlobalVars.ClockAccuracyNsec = + (1000000000 + (OS_SharedGlobalVars.TicksPerSecond / 2)) / OS_SharedGlobalVars.TicksPerSecond; /* * Finally compute the Microseconds per tick @@ -331,8 +331,8 @@ int32 OS_TimeBaseCreate_Impl(const OS_object_token_t *token) * The tick_sem is a simple semaphore posted by the ISR and taken by the * timebase helper task (created later). */ - rtems_sc = rtems_semaphore_create(r_name, 0, RTEMS_SIMPLE_BINARY_SEMAPHORE | RTEMS_PRIORITY, 0, - &local->tick_sem); + rtems_sc = + rtems_semaphore_create(r_name, 0, RTEMS_SIMPLE_BINARY_SEMAPHORE | RTEMS_PRIORITY, 0, &local->tick_sem); if (rtems_sc != RTEMS_SUCCESSFUL) { OS_DEBUG("Error: Tick Sem could not be created: %d\n", (int)rtems_sc); diff --git a/src/os/shared/inc/os-shared-binsem.h b/src/os/shared/inc/os-shared-binsem.h index 9ba97e4d9..b4273c426 100644 --- a/src/os/shared/inc/os-shared-binsem.h +++ b/src/os/shared/inc/os-shared-binsem.h @@ -122,4 +122,4 @@ int32 OS_BinSemDelete_Impl(const OS_object_token_t *token); ------------------------------------------------------------------*/ int32 OS_BinSemGetInfo_Impl(const OS_object_token_t *token, OS_bin_sem_prop_t *bin_prop); -#endif /* OS_SHARED_BINSEM_H */ +#endif /* OS_SHARED_BINSEM_H */ diff --git a/src/os/shared/inc/os-shared-clock.h b/src/os/shared/inc/os-shared-clock.h index 97da529bb..dab3a5ea1 100644 --- a/src/os/shared/inc/os-shared-clock.h +++ b/src/os/shared/inc/os-shared-clock.h @@ -54,4 +54,4 @@ int32 OS_GetLocalTime_Impl(OS_time_t *time_struct); ------------------------------------------------------------------*/ int32 OS_SetLocalTime_Impl(const OS_time_t *time_struct); -#endif /* OS_SHARED_CLOCK_H */ +#endif /* OS_SHARED_CLOCK_H */ diff --git a/src/os/shared/inc/os-shared-common.h b/src/os/shared/inc/os-shared-common.h index c3ae45f76..f9eb15180 100644 --- a/src/os/shared/inc/os-shared-common.h +++ b/src/os/shared/inc/os-shared-common.h @@ -128,4 +128,27 @@ void OS_IdleLoop_Impl(void); ------------------------------------------------------------------*/ void OS_ApplicationShutdown_Impl(void); -#endif /* OS_SHARED_COMMON_H */ +/*---------------------------------------------------------------- + + Function: OS_strnlen + + Purpose: Utility function to safely find the length of a string + within a fixed-size array buffer. + + Provides a local OSAL routine to get the functionality + of the (non-C99) "strnlen()" function, via the + C89/C99 standard "memchr()" function instead. + + ------------------------------------------------------------------*/ +static inline size_t OS_strnlen(const char *s, size_t maxlen) +{ + const char *end = memchr(s, 0, maxlen); + if (end != NULL) + { + /* actual length of string is difference */ + maxlen = end - s; + } + return maxlen; +} + +#endif /* OS_SHARED_COMMON_H */ diff --git a/src/os/shared/inc/os-shared-countsem.h b/src/os/shared/inc/os-shared-countsem.h index 4330125ab..c02cc9db4 100644 --- a/src/os/shared/inc/os-shared-countsem.h +++ b/src/os/shared/inc/os-shared-countsem.h @@ -112,4 +112,4 @@ int32 OS_CountSemDelete_Impl(const OS_object_token_t *token); ------------------------------------------------------------------*/ int32 OS_CountSemGetInfo_Impl(const OS_object_token_t *token, OS_count_sem_prop_t *count_prop); -#endif /* OS_SHARED_COUNTSEM_H */ +#endif /* OS_SHARED_COUNTSEM_H */ diff --git a/src/os/shared/inc/os-shared-dir.h b/src/os/shared/inc/os-shared-dir.h index df8d1257b..081f5ae60 100644 --- a/src/os/shared/inc/os-shared-dir.h +++ b/src/os/shared/inc/os-shared-dir.h @@ -111,4 +111,4 @@ int32 OS_DirRewind_Impl(const OS_object_token_t *token); ------------------------------------------------------------------*/ int32 OS_DirRemove_Impl(const char *local_path); -#endif /* OS_SHARED_DIR_H */ +#endif /* OS_SHARED_DIR_H */ diff --git a/src/os/shared/inc/os-shared-errors.h b/src/os/shared/inc/os-shared-errors.h index 131db4435..a93764caf 100644 --- a/src/os/shared/inc/os-shared-errors.h +++ b/src/os/shared/inc/os-shared-errors.h @@ -39,4 +39,4 @@ typedef struct extern const OS_ErrorTable_Entry_t OS_IMPL_ERROR_NAME_TABLE[]; -#endif /* OS_SHARED_ERRORS_H */ +#endif /* OS_SHARED_ERRORS_H */ diff --git a/src/os/shared/inc/os-shared-file.h b/src/os/shared/inc/os-shared-file.h index fcadb2c40..715908dc3 100644 --- a/src/os/shared/inc/os-shared-file.h +++ b/src/os/shared/inc/os-shared-file.h @@ -183,4 +183,12 @@ int32 OS_FileRename_Impl(const char *old_path, const char *new_path); ------------------------------------------------------------------*/ int32 OS_FileChmod_Impl(const char *local_path, uint32 access); -#endif /* OS_SHARED_FILE_H */ +/* + * Internal helper function + * + * Not called outside this unit, but need to be prototyped + * here for coverage test. + */ +int32 OS_FileIteratorClose(osal_id_t filedes, void *arg); + +#endif /* OS_SHARED_FILE_H */ diff --git a/src/os/shared/inc/os-shared-filesys.h b/src/os/shared/inc/os-shared-filesys.h index 717699f1f..b16a3765e 100644 --- a/src/os/shared/inc/os-shared-filesys.h +++ b/src/os/shared/inc/os-shared-filesys.h @@ -190,5 +190,6 @@ int32 OS_FileSysUnmountVolume_Impl(const OS_object_token_t *token); bool OS_FileSys_FindVirtMountPoint(void *ref, const OS_object_token_t *token, const OS_common_record_t *obj); int32 OS_FileSys_Initialize(char *address, const char *fsdevname, const char *fsvolname, size_t blocksize, osal_blockcount_t numblocks, bool should_format); +bool OS_FileSysFilterFree(void *ref, const OS_object_token_t *token, const OS_common_record_t *obj); -#endif /* OS_SHARED_FILESYS_H */ +#endif /* OS_SHARED_FILESYS_H */ diff --git a/src/os/shared/inc/os-shared-globaldefs.h b/src/os/shared/inc/os-shared-globaldefs.h index 39da9b5e2..dc35c88c4 100644 --- a/src/os/shared/inc/os-shared-globaldefs.h +++ b/src/os/shared/inc/os-shared-globaldefs.h @@ -69,10 +69,10 @@ typedef struct OS_object_token OS_object_token_t; */ typedef union { - void * opaque_arg; - OS_ArgCallback_t arg_callback_func; - osal_id_t id; - osal_index_t idx; + void * opaque_arg; + OS_ArgCallback_t arg_callback_func; + osal_id_t id; + osal_index_t idx; } OS_U32ValueWrapper_t; /* @@ -109,7 +109,7 @@ extern void OS_DebugPrintf(uint32 Level, const char *Func, uint32 Line, const ch * (e.g. read/write) return a size as an int32 type, and therefore the * operation cannot exceed the bounds of this type. */ -#define OS_CHECK_SIZE(val) ARGCHECK((val) > 0 && (val) < (UINT32_MAX/2), OS_ERR_INVALID_SIZE) +#define OS_CHECK_SIZE(val) ARGCHECK((val) > 0 && (val) < (UINT32_MAX / 2), OS_ERR_INVALID_SIZE) /* * An OSAL-specific check macro for arbitrary string argument validation. diff --git a/src/os/shared/inc/os-shared-heap.h b/src/os/shared/inc/os-shared-heap.h index 0bd19d854..d419d7d4a 100644 --- a/src/os/shared/inc/os-shared-heap.h +++ b/src/os/shared/inc/os-shared-heap.h @@ -48,4 +48,4 @@ ------------------------------------------------------------------*/ int32 OS_HeapGetInfo_Impl(OS_heap_prop_t *heap_prop); -#endif /* OS_SHARED_HEAP_H */ +#endif /* OS_SHARED_HEAP_H */ diff --git a/src/os/shared/inc/os-shared-idmap.h b/src/os/shared/inc/os-shared-idmap.h index a08e16628..9f487c82e 100644 --- a/src/os/shared/inc/os-shared-idmap.h +++ b/src/os/shared/inc/os-shared-idmap.h @@ -52,7 +52,8 @@ typedef enum OS_LOCK_MODE_NONE, /**< Quick ID validity check, does not lock global table at all (use with caution) */ OS_LOCK_MODE_GLOBAL, /**< Confirm ID match, and if successful, leave global table locked */ OS_LOCK_MODE_REFCOUNT, /**< Confirm ID match, increment refcount, and unlock global table. ID is not changed. */ - OS_LOCK_MODE_EXCLUSIVE, /**< Confirm ID match AND refcount equal zero, then change ID to RESERVED value and unlock global. */ + OS_LOCK_MODE_EXCLUSIVE, /**< Confirm ID match AND refcount equal zero, then change ID to RESERVED value and unlock + global. */ OS_LOCK_MODE_RESERVED /**< Confirm ID is already set to RESERVED, otherwise like OS_LOCK_MODE_GLOBAL. */ } OS_lock_mode_t; @@ -214,7 +215,6 @@ void OS_WaitForStateChange(OS_object_token_t *token, uint32 attempts); ------------------------------------------------------------------*/ void OS_WaitForStateChange_Impl(osal_objtype_t objtype, uint32 attempts); - /* Function prototypes for routines implemented in common layers but private to OSAL @@ -533,7 +533,7 @@ static inline const OS_object_token_t *OS_ObjectIdIteratorRef(OS_object_iter_t * Returns: None ------------------------------------------------------------------*/ -int32 OS_ObjectIdIteratorProcessEntry(OS_object_iter_t *iter, int32 (*func)(osal_id_t,void*)); +int32 OS_ObjectIdIteratorProcessEntry(OS_object_iter_t *iter, int32 (*func)(osal_id_t, void *)); /* * Internal helper functions @@ -545,4 +545,4 @@ bool OS_ObjectNameMatch(void *ref, const OS_object_token_t *token, const OS_com int32 OS_ObjectIdFindNextMatch(OS_ObjectMatchFunc_t MatchFunc, void *arg, OS_object_token_t *token); int32 OS_ObjectIdFindNextFree(OS_object_token_t *token); -#endif /* OS_SHARED_IDMAP_H */ +#endif /* OS_SHARED_IDMAP_H */ diff --git a/src/os/shared/inc/os-shared-module.h b/src/os/shared/inc/os-shared-module.h index 58bd6f542..5f0e53adb 100644 --- a/src/os/shared/inc/os-shared-module.h +++ b/src/os/shared/inc/os-shared-module.h @@ -130,4 +130,4 @@ int32 OS_SymbolTableDump_Impl(const char *filename, size_t size_limit); int32 OS_ModuleLoad_Static(const char *ModuleName); int32 OS_SymbolLookup_Static(cpuaddr *SymbolAddress, const char *SymbolName, const char *ModuleName); -#endif /* OS_SHARED_MODULE_H */ +#endif /* OS_SHARED_MODULE_H */ diff --git a/src/os/shared/inc/os-shared-mutex.h b/src/os/shared/inc/os-shared-mutex.h index 7658ed28b..524f9fcde 100644 --- a/src/os/shared/inc/os-shared-mutex.h +++ b/src/os/shared/inc/os-shared-mutex.h @@ -33,8 +33,8 @@ typedef struct { - char obj_name[OS_MAX_API_NAME]; - osal_id_t last_owner; + char obj_name[OS_MAX_API_NAME]; + osal_id_t last_owner; } OS_mutex_internal_record_t; /* @@ -97,4 +97,4 @@ int32 OS_MutSemDelete_Impl(const OS_object_token_t *token); ------------------------------------------------------------------*/ int32 OS_MutSemGetInfo_Impl(const OS_object_token_t *token, OS_mut_sem_prop_t *mut_prop); -#endif /* OS_SHARED_MUTEX_H */ +#endif /* OS_SHARED_MUTEX_H */ diff --git a/src/os/shared/inc/os-shared-network.h b/src/os/shared/inc/os-shared-network.h index 8515d5be8..19fd03d79 100644 --- a/src/os/shared/inc/os-shared-network.h +++ b/src/os/shared/inc/os-shared-network.h @@ -63,4 +63,4 @@ int32 OS_NetworkGetHostName_Impl(char *host_name, size_t name_len); ------------------------------------------------------------------*/ int32 OS_NetworkGetID_Impl(int32 *IdBuf); -#endif /* OS_SHARED_NETWORK_H */ +#endif /* OS_SHARED_NETWORK_H */ diff --git a/src/os/shared/inc/os-shared-printf.h b/src/os/shared/inc/os-shared-printf.h index 8deeaab68..43393a154 100644 --- a/src/os/shared/inc/os-shared-printf.h +++ b/src/os/shared/inc/os-shared-printf.h @@ -103,4 +103,4 @@ void OS_ConsoleOutput_Impl(const OS_object_token_t *token); ------------------------------------------------------------------*/ void OS_ConsoleWakeup_Impl(const OS_object_token_t *token); -#endif /* OS_SHARED_PRINTF_H */ +#endif /* OS_SHARED_PRINTF_H */ diff --git a/src/os/shared/inc/os-shared-queue.h b/src/os/shared/inc/os-shared-queue.h index 3f68ef98f..d0d123989 100644 --- a/src/os/shared/inc/os-shared-queue.h +++ b/src/os/shared/inc/os-shared-queue.h @@ -107,4 +107,4 @@ int32 OS_QueuePut_Impl(const OS_object_token_t *token, const void *data, size_t ------------------------------------------------------------------*/ int32 OS_QueueGetInfo_Impl(const OS_object_token_t *token, OS_queue_prop_t *queue_prop); -#endif /* OS_SHARED_QUEUE_H */ +#endif /* OS_SHARED_QUEUE_H */ diff --git a/src/os/shared/inc/os-shared-select.h b/src/os/shared/inc/os-shared-select.h index 7b8d58cc9..051bf4a50 100644 --- a/src/os/shared/inc/os-shared-select.h +++ b/src/os/shared/inc/os-shared-select.h @@ -78,4 +78,4 @@ int32 OS_SelectSingle_Impl(const OS_object_token_t *token, uint32 *SelectFlags, ------------------------------------------------------------------*/ int32 OS_SelectMultiple_Impl(OS_FdSet *ReadSet, OS_FdSet *WriteSet, int32 msecs); -#endif /* OS_SHARED_SELECT_H */ +#endif /* OS_SHARED_SELECT_H */ diff --git a/src/os/shared/inc/os-shared-shell.h b/src/os/shared/inc/os-shared-shell.h index be16a296c..db58583b7 100644 --- a/src/os/shared/inc/os-shared-shell.h +++ b/src/os/shared/inc/os-shared-shell.h @@ -44,4 +44,4 @@ ------------------------------------------------------------------*/ int32 OS_ShellOutputToFile_Impl(const OS_object_token_t *token, const char *Cmd); -#endif /* OS_SHARED_SHELL_H */ +#endif /* OS_SHARED_SHELL_H */ diff --git a/src/os/shared/inc/os-shared-sockets.h b/src/os/shared/inc/os-shared-sockets.h index 3bcdcbd62..7c3175753 100644 --- a/src/os/shared/inc/os-shared-sockets.h +++ b/src/os/shared/inc/os-shared-sockets.h @@ -180,4 +180,4 @@ int32 OS_SocketAddrSetPort_Impl(OS_SockAddr_t *Addr, uint16 PortNum); */ void OS_CreateSocketName(const OS_object_token_t *token, const OS_SockAddr_t *Addr, const char *parent_name); -#endif /* OS_SHARED_SOCKETS_H */ +#endif /* OS_SHARED_SOCKETS_H */ diff --git a/src/os/shared/inc/os-shared-task.h b/src/os/shared/inc/os-shared-task.h index f6826f05f..29f45fcbe 100644 --- a/src/os/shared/inc/os-shared-task.h +++ b/src/os/shared/inc/os-shared-task.h @@ -192,4 +192,4 @@ bool OS_TaskIdMatchSystemData_Impl(void *ref, const OS_object_token_t *token, co ------------------------------------------------------------------*/ int32 OS_TaskValidateSystemData_Impl(const void *sysdata, size_t sysdata_size); -#endif /* OS_SHARED_TASK_H */ +#endif /* OS_SHARED_TASK_H */ diff --git a/src/os/shared/inc/os-shared-time.h b/src/os/shared/inc/os-shared-time.h index 74f0a8dcc..1cf14a15e 100644 --- a/src/os/shared/inc/os-shared-time.h +++ b/src/os/shared/inc/os-shared-time.h @@ -64,4 +64,4 @@ extern OS_timecb_internal_record_t OS_timecb_table[OS_MAX_TIMERS]; ---------------------------------------------------------------------------------------*/ int32 OS_TimerCbAPI_Init(void); -#endif /* OS_SHARED_TIME_H */ +#endif /* OS_SHARED_TIME_H */ diff --git a/src/os/shared/inc/os-shared-timebase.h b/src/os/shared/inc/os-shared-timebase.h index 3875da5f3..4e838d227 100644 --- a/src/os/shared/inc/os-shared-timebase.h +++ b/src/os/shared/inc/os-shared-timebase.h @@ -138,4 +138,4 @@ void OS_TimeBase_CallbackThread(osal_id_t timebase_id); ------------------------------------------------------------------*/ int32 OS_Milli2Ticks(uint32 milli_seconds, int *ticks); -#endif /* OS_SHARED_TIMEBASE_H */ +#endif /* OS_SHARED_TIMEBASE_H */ diff --git a/src/os/shared/src/osapi-binsem.c b/src/os/shared/src/osapi-binsem.c index 49510ae1c..e498db02f 100644 --- a/src/os/shared/src/osapi-binsem.c +++ b/src/os/shared/src/osapi-binsem.c @@ -100,7 +100,7 @@ int32 OS_BinSemCreate(osal_id_t *sem_id, const char *sem_name, uint32 sem_initia OS_object_token_t token; OS_bin_sem_internal_record_t *binsem; - /* Check inputs */ + /* Check parameters */ OS_CHECK_POINTER(sem_id); OS_CHECK_APINAME(sem_name); @@ -255,7 +255,7 @@ int32 OS_BinSemGetIdByName(osal_id_t *sem_id, const char *sem_name) { int32 return_code; - /* Check inputs */ + /* Check parameters */ OS_CHECK_POINTER(sem_id); OS_CHECK_POINTER(sem_name); @@ -278,7 +278,7 @@ int32 OS_BinSemGetInfo(osal_id_t sem_id, OS_bin_sem_prop_t *bin_prop) OS_object_token_t token; int32 return_code; - /* Check inputs */ + /* Check parameters */ OS_CHECK_POINTER(bin_prop); memset(bin_prop, 0, sizeof(OS_bin_sem_prop_t)); @@ -289,7 +289,7 @@ int32 OS_BinSemGetInfo(osal_id_t sem_id, OS_bin_sem_prop_t *bin_prop) { record = OS_OBJECT_TABLE_GET(OS_global_bin_sem_table, token); - strncpy(bin_prop->name, record->name_entry, OS_MAX_API_NAME - 1); + strncpy(bin_prop->name, record->name_entry, sizeof(bin_prop->name) - 1); bin_prop->creator = record->creator; return_code = OS_BinSemGetInfo_Impl(&token, bin_prop); diff --git a/src/os/shared/src/osapi-clock.c b/src/os/shared/src/osapi-clock.c index 1aec8bfc8..d5a844376 100644 --- a/src/os/shared/src/osapi-clock.c +++ b/src/os/shared/src/osapi-clock.c @@ -50,7 +50,7 @@ *-----------------------------------------------------------------*/ int32 OS_GetLocalTime(OS_time_t *time_struct) { - /* Check inputs */ + /* Check parameters */ OS_CHECK_POINTER(time_struct); return OS_GetLocalTime_Impl(time_struct); @@ -67,7 +67,7 @@ int32 OS_GetLocalTime(OS_time_t *time_struct) *-----------------------------------------------------------------*/ int32 OS_SetLocalTime(const OS_time_t *time_struct) { - /* Check inputs */ + /* Check parameters */ OS_CHECK_POINTER(time_struct); return OS_SetLocalTime_Impl(time_struct); diff --git a/src/os/shared/src/osapi-common.c b/src/os/shared/src/osapi-common.c index 62a5a433b..2848228c8 100644 --- a/src/os/shared/src/osapi-common.c +++ b/src/os/shared/src/osapi-common.c @@ -339,12 +339,9 @@ void OS_DeleteAllObjects(void) ++TryCount; /* Delete timers and tasks first, as they could be actively using other object types */ - OS_ForEachObjectOfType(OS_OBJECT_TYPE_OS_TIMECB, OS_OBJECT_CREATOR_ANY, - OS_CleanUpObject, &ObjectCount); - OS_ForEachObjectOfType(OS_OBJECT_TYPE_OS_TIMEBASE, OS_OBJECT_CREATOR_ANY, - OS_CleanUpObject, &ObjectCount); - OS_ForEachObjectOfType(OS_OBJECT_TYPE_OS_TASK, OS_OBJECT_CREATOR_ANY, - OS_CleanUpObject, &ObjectCount); + OS_ForEachObjectOfType(OS_OBJECT_TYPE_OS_TIMECB, OS_OBJECT_CREATOR_ANY, OS_CleanUpObject, &ObjectCount); + OS_ForEachObjectOfType(OS_OBJECT_TYPE_OS_TIMEBASE, OS_OBJECT_CREATOR_ANY, OS_CleanUpObject, &ObjectCount); + OS_ForEachObjectOfType(OS_OBJECT_TYPE_OS_TASK, OS_OBJECT_CREATOR_ANY, OS_CleanUpObject, &ObjectCount); /* Then try to delete all other remaining objects of any type */ OS_ForEachObject(OS_OBJECT_CREATOR_ANY, OS_CleanUpObject, &ObjectCount); diff --git a/src/os/shared/src/osapi-countsem.c b/src/os/shared/src/osapi-countsem.c index 9afcd2850..9eebafc84 100644 --- a/src/os/shared/src/osapi-countsem.c +++ b/src/os/shared/src/osapi-countsem.c @@ -92,7 +92,7 @@ int32 OS_CountSemCreate(osal_id_t *sem_id, const char *sem_name, uint32 sem_init OS_object_token_t token; OS_count_sem_internal_record_t *countsem; - /* Check inputs */ + /* Check parameters */ OS_CHECK_POINTER(sem_id); OS_CHECK_APINAME(sem_name); @@ -224,7 +224,7 @@ int32 OS_CountSemGetIdByName(osal_id_t *sem_id, const char *sem_name) { int32 return_code; - /* Check inputs */ + /* Check parameters */ OS_CHECK_POINTER(sem_id); OS_CHECK_POINTER(sem_name); @@ -247,7 +247,7 @@ int32 OS_CountSemGetInfo(osal_id_t sem_id, OS_count_sem_prop_t *count_prop) OS_object_token_t token; int32 return_code; - /* Check inputs */ + /* Check parameters */ OS_CHECK_POINTER(count_prop); memset(count_prop, 0, sizeof(OS_count_sem_prop_t)); @@ -258,7 +258,7 @@ int32 OS_CountSemGetInfo(osal_id_t sem_id, OS_count_sem_prop_t *count_prop) { record = OS_OBJECT_TABLE_GET(OS_global_count_sem_table, token); - strncpy(count_prop->name, record->name_entry, OS_MAX_API_NAME - 1); + strncpy(count_prop->name, record->name_entry, sizeof(count_prop->name) - 1); count_prop->creator = record->creator; return_code = OS_CountSemGetInfo_Impl(&token, count_prop); diff --git a/src/os/shared/src/osapi-dir.c b/src/os/shared/src/osapi-dir.c index 06f55cdb3..7566aa606 100644 --- a/src/os/shared/src/osapi-dir.c +++ b/src/os/shared/src/osapi-dir.c @@ -118,7 +118,7 @@ int32 OS_DirectoryOpen(osal_id_t *dir_id, const char *path) OS_dir_internal_record_t *dir; int32 return_code; - /* Check inputs */ + /* Check parameters */ OS_CHECK_POINTER(dir_id); return_code = OS_TranslatePath(path, local_path); @@ -183,7 +183,7 @@ int32 OS_DirectoryRead(osal_id_t dir_id, os_dirent_t *dirent) OS_object_token_t token; int32 return_code; - /* Check inputs */ + /* Check parameters */ OS_CHECK_POINTER(dirent); /* Make sure the file descriptor is legit before using it */ diff --git a/src/os/shared/src/osapi-errors.c b/src/os/shared/src/osapi-errors.c index ddfe12f9b..a7abfa09a 100644 --- a/src/os/shared/src/osapi-errors.c +++ b/src/os/shared/src/osapi-errors.c @@ -98,9 +98,10 @@ static const OS_ErrorTable_Entry_t OS_GLOBAL_ERROR_NAME_TABLE[] = { *-----------------------------------------------------------------*/ int32 OS_GetErrorName(int32 error_num, os_err_name_t *err_name) { - uint32 return_code; + int32 return_code; const OS_ErrorTable_Entry_t *Error; + /* Check parameters */ OS_CHECK_POINTER(err_name); Error = OS_GLOBAL_ERROR_NAME_TABLE; @@ -120,8 +121,9 @@ int32 OS_GetErrorName(int32 error_num, os_err_name_t *err_name) if (Error->Number == error_num && Error->Name != NULL) { - strncpy(*err_name, Error->Name, OS_ERROR_NAME_LENGTH - 1); - return_code = OS_SUCCESS; + strncpy(*err_name, Error->Name, sizeof(*err_name) - 1); + *err_name[sizeof(*err_name) - 1] = 0; + return_code = OS_SUCCESS; } else { diff --git a/src/os/shared/src/osapi-file.c b/src/os/shared/src/osapi-file.c index 1db28e3da..6781985d1 100644 --- a/src/os/shared/src/osapi-file.c +++ b/src/os/shared/src/osapi-file.c @@ -47,8 +47,6 @@ #include "osapi-filesys.h" #include "osapi-sockets.h" - - /* * Sanity checks on the user-supplied configuration * The relevent OS_MAX limit should be defined and greater than zero @@ -112,6 +110,7 @@ int32 OS_OpenCreate(osal_id_t *filedes, const char *path, int32 flags, int32 acc OS_object_token_t token; OS_stream_internal_record_t *stream; + /* Check parameters */ OS_CHECK_POINTER(filedes); /* @@ -474,7 +473,8 @@ int32 OS_rename(const char *old, const char *new) if (stream->socket_domain == OS_SocketDomain_INVALID && strcmp(stream->stream_name, old) == 0) { - strcpy(stream->stream_name, new); + strncpy(stream->stream_name, new, sizeof(stream->stream_name) - 1); + stream->stream_name[sizeof(stream->stream_name) - 1] = 0; } } @@ -605,7 +605,7 @@ int32 OS_FDGetInfo(osal_id_t filedes, OS_file_prop_t *fd_prop) { record = OS_OBJECT_TABLE_GET(OS_global_stream_table, token); - strncpy(fd_prop->Path, record->name_entry, OS_MAX_PATH_LEN - 1); + strncpy(fd_prop->Path, record->name_entry, sizeof(fd_prop->Path) - 1); fd_prop->User = record->creator; fd_prop->IsValid = true; @@ -630,6 +630,7 @@ int32 OS_FileOpenCheck(const char *Filename) OS_object_iter_t iter; OS_stream_internal_record_t *stream; + /* Check parameters */ OS_CHECK_POINTER(Filename); return_code = OS_ERROR; @@ -666,6 +667,7 @@ int32 OS_CloseFileByName(const char *Filename) OS_object_iter_t iter; OS_stream_internal_record_t *stream; + /* Check parameters */ OS_CHECK_POINTER(Filename); return_code = OS_FS_ERR_PATH_INVALID; diff --git a/src/os/shared/src/osapi-filesys.c b/src/os/shared/src/osapi-filesys.c index 6db99f794..9eb01c768 100644 --- a/src/os/shared/src/osapi-filesys.c +++ b/src/os/shared/src/osapi-filesys.c @@ -42,6 +42,7 @@ */ #include "os-shared-filesys.h" #include "os-shared-idmap.h" +#include "os-shared-common.h" enum { @@ -102,9 +103,9 @@ bool OS_FileSys_FindVirtMountPoint(void *ref, const OS_object_token_t *token, co return false; } - mplen = strlen(filesys->virtual_mountpt); - return (mplen > 0 && strncmp(target, filesys->virtual_mountpt, mplen) == 0 && - (target[mplen] == '/' || target[mplen] == 0)); + mplen = OS_strnlen(filesys->virtual_mountpt, sizeof(filesys->virtual_mountpt)); + return (mplen > 0 && mplen < sizeof(filesys->virtual_mountpt) && + strncmp(target, filesys->virtual_mountpt, mplen) == 0 && (target[mplen] == '/' || target[mplen] == 0)); } /* end OS_FileSys_FindVirtMountPoint */ /*---------------------------------------------------------------- @@ -126,8 +127,10 @@ int32 OS_FileSys_Initialize(char *address, const char *fsdevname, const char *fs OS_object_token_t token; /* - ** Check parameters - */ + * Check parameters + * + * Note "address" is not checked, because in certain configurations it can be validly null. + */ OS_CHECK_STRING(fsdevname, sizeof(filesys->device_name), OS_FS_ERR_PATH_TOO_LONG); OS_CHECK_STRING(fsvolname, sizeof(filesys->volume_name), OS_FS_ERR_PATH_TOO_LONG); @@ -150,7 +153,7 @@ int32 OS_FileSys_Initialize(char *address, const char *fsdevname, const char *fs filesys->blocksize = blocksize; filesys->numblocks = numblocks; filesys->address = address; - strcpy(filesys->volume_name, fsvolname); + strncpy(filesys->volume_name, fsvolname, sizeof(filesys->volume_name) - 1); /* * Determine basic type of filesystem, if not already known @@ -257,7 +260,7 @@ int32 OS_FileSysAddFixedMap(osal_id_t *filesys_id, const char *phys_path, const ++dev_name; } - if (strlen(dev_name) >= OS_FS_DEV_NAME_LEN) + if (memchr(dev_name, 0, sizeof(filesys->volume_name)) == NULL) { return OS_ERR_NAME_TOO_LONG; } @@ -350,6 +353,7 @@ int32 OS_rmfs(const char *devname) int32 return_code; OS_object_token_t token; + /* Check parameters */ OS_CHECK_PATHNAME(devname); return_code = OS_ObjectIdGetByName(OS_LOCK_MODE_EXCLUSIVE, LOCAL_OBJID_TYPE, devname, &token); @@ -458,7 +462,8 @@ int32 OS_mount(const char *devname, const char *mountpoint) /* mark as mounted in the local table. * For now this does both sides (system and virtual) */ filesys->flags |= OS_FILESYS_FLAG_IS_MOUNTED_SYSTEM | OS_FILESYS_FLAG_IS_MOUNTED_VIRTUAL; - strcpy(filesys->virtual_mountpt, mountpoint); + strncpy(filesys->virtual_mountpt, mountpoint, sizeof(filesys->virtual_mountpt) - 1); + filesys->virtual_mountpt[sizeof(filesys->virtual_mountpt) - 1] = 0; } OS_ObjectIdRelease(&token); @@ -618,7 +623,7 @@ int32 OS_fsBytesFree(const char *name, uint64 *bytes_free) } /* end OS_fsBytesFree */ -#endif /* OSAL_OMIT_DEPRECATED */ +#endif /* OSAL_OMIT_DEPRECATED */ /*---------------------------------------------------------------- * @@ -786,14 +791,14 @@ int32 OS_TranslatePath(const char *VirtualPath, char *LocalPath) /* ** Check to see if the path pointers are NULL */ - /* Check inputs */ + /* Check parameters */ OS_CHECK_POINTER(VirtualPath); OS_CHECK_POINTER(LocalPath); /* ** Check length */ - VirtPathLen = strlen(VirtualPath); + VirtPathLen = OS_strnlen(VirtualPath, OS_MAX_PATH_LEN); if (VirtPathLen >= OS_MAX_PATH_LEN) { return OS_FS_ERR_PATH_TOO_LONG; @@ -808,7 +813,7 @@ int32 OS_TranslatePath(const char *VirtualPath, char *LocalPath) /* strrchr returns a pointer to the last '/' char, so we advance one char */ name_ptr = name_ptr + 1; - if (strlen(name_ptr) >= OS_MAX_FILE_NAME) + if (memchr(name_ptr, 0, OS_MAX_FILE_NAME) == NULL) { return OS_FS_ERR_NAME_TOO_LONG; } @@ -838,8 +843,8 @@ int32 OS_TranslatePath(const char *VirtualPath, char *LocalPath) if ((filesys->flags & OS_FILESYS_FLAG_IS_MOUNTED_SYSTEM) != 0) { - SysMountPointLen = strlen(filesys->system_mountpt); - VirtPathBegin = strlen(filesys->virtual_mountpt); + SysMountPointLen = OS_strnlen(filesys->system_mountpt, sizeof(filesys->system_mountpt)); + VirtPathBegin = OS_strnlen(filesys->virtual_mountpt, sizeof(filesys->virtual_mountpt)); if (SysMountPointLen < OS_MAX_LOCAL_PATH_LEN) { memcpy(LocalPath, filesys->system_mountpt, SysMountPointLen); diff --git a/src/os/shared/src/osapi-heap.c b/src/os/shared/src/osapi-heap.c index 15ec6750e..888d0d7ec 100644 --- a/src/os/shared/src/osapi-heap.c +++ b/src/os/shared/src/osapi-heap.c @@ -50,6 +50,7 @@ *-----------------------------------------------------------------*/ int32 OS_HeapGetInfo(OS_heap_prop_t *heap_prop) { + /* Check parameters */ OS_CHECK_POINTER(heap_prop); return OS_HeapGetInfo_Impl(heap_prop); diff --git a/src/os/shared/src/osapi-idmap.c b/src/os/shared/src/osapi-idmap.c index a8fb26c4b..1e2496662 100644 --- a/src/os/shared/src/osapi-idmap.c +++ b/src/os/shared/src/osapi-idmap.c @@ -91,7 +91,6 @@ typedef struct void * user_arg; } OS_creator_filter_t; - /* * Global ID storage tables */ @@ -270,7 +269,6 @@ int32 OS_ForEachDoCallback(osal_id_t obj_id, void *ref) return OS_SUCCESS; } - /*---------------------------------------------------------------- * * Function: OS_ObjectIdGlobalFromToken @@ -631,7 +629,7 @@ int32 OS_ObjectIdFindNextFree(OS_object_token_t *token) { uint32 max_id; uint32 base_id; - uint32 local_id; + uint32 local_id = 0; uint32 serial; uint32 i; int32 return_code; @@ -747,16 +745,17 @@ void OS_Lock_Global(OS_object_token_t *token) * This makes it different for every operation, and different depending * on what task is calling the function. */ - token->lock_key.key_value = OS_LOCK_KEY_FIXED_VALUE | - ((OS_ObjectIdToInteger(self_task_id) ^ objtype->transaction_count) & 0xFFFFFF); + token->lock_key.key_value = + OS_LOCK_KEY_FIXED_VALUE | ((OS_ObjectIdToInteger(self_task_id) ^ objtype->transaction_count) & 0xFFFFFF); ++objtype->transaction_count; if (objtype->owner_key.key_value != 0) { /* this is almost certainly a bug */ - OS_DEBUG("ERROR: global %u acquired by task 0x%lx when already assigned key 0x%lx\n", (unsigned int)token->obj_type, - OS_ObjectIdToInteger(self_task_id), (unsigned long)objtype->owner_key.key_value); + OS_DEBUG("ERROR: global %u acquired by task 0x%lx when already assigned key 0x%lx\n", + (unsigned int)token->obj_type, OS_ObjectIdToInteger(self_task_id), + (unsigned long)objtype->owner_key.key_value); } else { @@ -765,8 +764,8 @@ void OS_Lock_Global(OS_object_token_t *token) } else { - OS_DEBUG("ERROR: cannot lock global %u for mode %u\n", - (unsigned int)token->obj_type, (unsigned int)token->lock_mode); + OS_DEBUG("ERROR: cannot lock global %u for mode %u\n", (unsigned int)token->obj_type, + (unsigned int)token->lock_mode); } } @@ -795,8 +794,9 @@ void OS_Unlock_Global(OS_object_token_t *token) objtype->owner_key.key_value != token->lock_key.key_value) { /* this is almost certainly a bug */ - OS_DEBUG("ERROR: global %u released using mismatched key=0x%lx expected=0x%lx\n", (unsigned int)token->obj_type, - (unsigned long)token->lock_key.key_value, (unsigned long)objtype->owner_key.key_value); + OS_DEBUG("ERROR: global %u released using mismatched key=0x%lx expected=0x%lx\n", + (unsigned int)token->obj_type, (unsigned long)token->lock_key.key_value, + (unsigned long)objtype->owner_key.key_value); } objtype->owner_key = OS_LOCK_KEY_INVALID; @@ -806,8 +806,8 @@ void OS_Unlock_Global(OS_object_token_t *token) } else { - OS_DEBUG("ERROR: cannot unlock global %u for mode %u\n", - (unsigned int)token->obj_type, (unsigned int)token->lock_mode); + OS_DEBUG("ERROR: cannot unlock global %u for mode %u\n", (unsigned int)token->obj_type, + (unsigned int)token->lock_mode); } } @@ -1433,7 +1433,8 @@ void OS_ForEachObject(osal_id_t creator_id, OS_ArgCallback_t callback_ptr, void * See description in API and header file for detail * *-----------------------------------------------------------------*/ -void OS_ForEachObjectOfType(osal_objtype_t idtype, osal_id_t creator_id, OS_ArgCallback_t callback_ptr, void *callback_arg) +void OS_ForEachObjectOfType(osal_objtype_t idtype, osal_id_t creator_id, OS_ArgCallback_t callback_ptr, + void *callback_arg) { OS_object_iter_t iter; OS_creator_filter_t filter; @@ -1501,7 +1502,7 @@ int32 OS_GetResourceName(osal_id_t object_id, char *buffer, size_t buffer_size) if (record->name_entry != NULL) { - name_len = strlen(record->name_entry); + name_len = OS_strnlen(record->name_entry, buffer_size); if (buffer_size <= name_len) { /* indicates the name does not fit into supplied buffer */ diff --git a/src/os/shared/src/osapi-module.c b/src/os/shared/src/osapi-module.c index 362334115..fd24962d1 100644 --- a/src/os/shared/src/osapi-module.c +++ b/src/os/shared/src/osapi-module.c @@ -46,7 +46,6 @@ */ #include "osapi-filesys.h" - /* * Sanity checks on the user-supplied configuration * The relevent OS_MAX limit should be defined @@ -112,7 +111,7 @@ int32 OS_SymbolLookup_Static(cpuaddr *SymbolAddress, const char *SymbolName, con break; } if (strcmp(StaticSym->Name, SymbolName) == 0 && - (ModuleName == NULL || strcmp(StaticSym->Module, ModuleName) == 0)) + (ModuleName == NULL || strcmp(StaticSym->Module, ModuleName) == 0)) { /* found matching symbol */ *SymbolAddress = (cpuaddr)StaticSym->Address; @@ -194,10 +193,10 @@ int32 OS_ModuleLoad(osal_id_t *module_id, const char *module_name, const char *f OS_module_internal_record_t *module; /* - ** Check parameters - ** - ** Note "filename" is not checked, because in certain configurations it can be validly - ** null. filename is checked for NULL-ness by the OS_TranslatePath() later. + * Check parameters + * + * Note "filename" is not checked, because in certain configurations it can be validly + * null. filename is checked for NULL-ness by the OS_TranslatePath() later. */ OS_CHECK_POINTER(module_id); OS_CHECK_APINAME(module_name); @@ -255,7 +254,7 @@ int32 OS_ModuleLoad(osal_id_t *module_id, const char *module_name, const char *f else { /* supplied filename was valid, so store a copy for future reference */ - strncpy(module->file_name, filename, OS_MAX_PATH_LEN); + strncpy(module->file_name, filename, sizeof(module->file_name) - 1); module->module_type = OS_MODULE_TYPE_DYNAMIC; /* Now call the OS-specific implementation. This reads info from the module table. */ @@ -333,8 +332,8 @@ int32 OS_ModuleInfo(osal_id_t module_id, OS_module_prop_t *module_prop) record = OS_OBJECT_TABLE_GET(OS_global_module_table, token); module = OS_OBJECT_TABLE_GET(OS_module_table, token); - strncpy(module_prop->name, record->name_entry, OS_MAX_API_NAME - 1); - strncpy(module_prop->filename, module->file_name, OS_MAX_API_NAME - 1); + strncpy(module_prop->name, record->name_entry, sizeof(module_prop->name) - 1); + strncpy(module_prop->filename, module->file_name, sizeof(module_prop->filename) - 1); return_code = OS_ModuleGetInfo_Impl(&token, module_prop); @@ -450,13 +449,11 @@ int32 OS_ModuleSymbolLookup(osal_id_t module_id, cpuaddr *symbol_address, const *-----------------------------------------------------------------*/ int32 OS_SymbolTableDump(const char *filename, size_t SizeLimit) { - int32 return_code; - char translated_path[OS_MAX_LOCAL_PATH_LEN]; + int32 return_code; + char translated_path[OS_MAX_LOCAL_PATH_LEN]; OS_object_token_t token; - /* - ** Check parameters - */ + /* Check parameters */ OS_CHECK_POINTER(filename); /* diff --git a/src/os/shared/src/osapi-mutex.c b/src/os/shared/src/osapi-mutex.c index 50d6a1fee..93cc0e92f 100644 --- a/src/os/shared/src/osapi-mutex.c +++ b/src/os/shared/src/osapi-mutex.c @@ -272,7 +272,7 @@ int32 OS_MutSemGetInfo(osal_id_t sem_id, OS_mut_sem_prop_t *mut_prop) { record = OS_OBJECT_TABLE_GET(OS_global_mutex_table, token); - strncpy(mut_prop->name, record->name_entry, OS_MAX_API_NAME - 1); + strncpy(mut_prop->name, record->name_entry, sizeof(mut_prop->name) - 1); mut_prop->creator = record->creator; return_code = OS_MutSemGetInfo_Impl(&token, mut_prop); diff --git a/src/os/shared/src/osapi-network.c b/src/os/shared/src/osapi-network.c index 3e6b9eeb9..70367fa16 100644 --- a/src/os/shared/src/osapi-network.c +++ b/src/os/shared/src/osapi-network.c @@ -65,7 +65,7 @@ int32 OS_NetworkAPI_Init(void) *-----------------------------------------------------------------*/ int32 OS_NetworkGetHostName(char *host_name, size_t name_len) { - uint32 return_code; + int32 return_code; /* Check parameters */ OS_CHECK_POINTER(host_name); diff --git a/src/os/shared/src/osapi-printf.c b/src/os/shared/src/osapi-printf.c index a174a4c61..f3bcac68c 100644 --- a/src/os/shared/src/osapi-printf.c +++ b/src/os/shared/src/osapi-printf.c @@ -111,7 +111,7 @@ int32 OS_ConsoleAPI_Init(void) OS_SharedGlobalVars.PrintfEnabled = true; } - return OS_SUCCESS; + return return_code; } /* end OS_ConsoleAPI_Init */ /* @@ -256,6 +256,8 @@ void OS_printf(const char *String, ...) char msg_buffer[OS_BUFFER_SIZE]; int actualsz; + BUGCHECK((String) != NULL, ) + if (!OS_SharedGlobalVars.Initialized) { /* diff --git a/src/os/shared/src/osapi-queue.c b/src/os/shared/src/osapi-queue.c index cda46e141..f50278f8e 100644 --- a/src/os/shared/src/osapi-queue.c +++ b/src/os/shared/src/osapi-queue.c @@ -87,7 +87,8 @@ int32 OS_QueueAPI_Init(void) * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_QueueCreate(osal_id_t *queue_id, const char *queue_name, osal_blockcount_t queue_depth, size_t data_size, uint32 flags) +int32 OS_QueueCreate(osal_id_t *queue_id, const char *queue_name, osal_blockcount_t queue_depth, size_t data_size, + uint32 flags) { int32 return_code; OS_object_token_t token; @@ -272,7 +273,7 @@ int32 OS_QueueGetInfo(osal_id_t queue_id, OS_queue_prop_t *queue_prop) { record = OS_OBJECT_TABLE_GET(OS_global_queue_table, token); - strncpy(queue_prop->name, record->name_entry, OS_MAX_API_NAME - 1); + strncpy(queue_prop->name, record->name_entry, sizeof(queue_prop->name) - 1); queue_prop->creator = record->creator; /* diff --git a/src/os/shared/src/osapi-select.c b/src/os/shared/src/osapi-select.c index d60b03288..f74453366 100644 --- a/src/os/shared/src/osapi-select.c +++ b/src/os/shared/src/osapi-select.c @@ -89,6 +89,12 @@ int32 OS_SelectMultiple(OS_FdSet *ReadSet, OS_FdSet *WriteSet, int32 msecs) { int32 return_code; + /* + * Check parameters + * + * Note "ReadSet" and "WriteSet" are not checked, because in certain configurations they can be validly null. + */ + /* * This does not currently increment any refcounts. * That means a file/socket can be closed while actively inside a diff --git a/src/os/shared/src/osapi-sockets.c b/src/os/shared/src/osapi-sockets.c index f610b8660..cdf0fded9 100644 --- a/src/os/shared/src/osapi-sockets.c +++ b/src/os/shared/src/osapi-sockets.c @@ -42,13 +42,13 @@ #include "os-shared-idmap.h" #include "os-shared-file.h" #include "os-shared-sockets.h" +#include "os-shared-common.h" /* * Other OSAL public APIs used by this module */ #include "osapi-select.h" - /* * Global data for the API */ @@ -104,7 +104,7 @@ void OS_CreateSocketName(const OS_object_token_t *token, const OS_SockAddr_t *Ad } if (OS_SocketAddrGetPort_Impl(&port, Addr) == OS_SUCCESS) { - len = strlen(sock->stream_name); + len = OS_strnlen(sock->stream_name, sizeof(sock->stream_name)); snprintf(&sock->stream_name[len], OS_MAX_API_NAME - len, ":%u", (unsigned int)port); } sock->stream_name[OS_MAX_API_NAME - 1] = 0; @@ -112,7 +112,7 @@ void OS_CreateSocketName(const OS_object_token_t *token, const OS_SockAddr_t *Ad if (parent_name) { /* Append the name from the parent socket. */ - len = strlen(sock->stream_name); + len = OS_strnlen(sock->stream_name, sizeof(sock->stream_name)); snprintf(&sock->stream_name[len], sizeof(sock->stream_name) - len, "-%s", parent_name); sock->stream_name[sizeof(sock->stream_name) - 1] = 0; } @@ -359,7 +359,11 @@ int32 OS_SocketRecvFrom(osal_id_t sock_id, void *buffer, size_t buflen, OS_SockA OS_object_token_t token; int32 return_code; - /* Check Parameters */ + /* + * Check parameters + * + * Note "RemoteAddr" is not checked, because in certain configurations it can be validly null. + */ OS_CHECK_POINTER(buffer); OS_CHECK_SIZE(buflen); @@ -473,7 +477,7 @@ int32 OS_SocketGetInfo(osal_id_t sock_id, OS_socket_prop_t *sock_prop) { record = OS_OBJECT_TABLE_GET(OS_global_stream_table, token); - strncpy(sock_prop->name, record->name_entry, OS_MAX_API_NAME - 1); + strncpy(sock_prop->name, record->name_entry, sizeof(sock_prop->name) - 1); sock_prop->creator = record->creator; return_code = OS_SocketGetInfo_Impl(&token, sock_prop); @@ -493,6 +497,7 @@ int32 OS_SocketGetInfo(osal_id_t sock_id, OS_socket_prop_t *sock_prop) *-----------------------------------------------------------------*/ int32 OS_SocketAddrInit(OS_SockAddr_t *Addr, OS_SocketDomain_t Domain) { + /* Check parameters */ OS_CHECK_POINTER(Addr); return OS_SocketAddrInit_Impl(Addr, Domain); @@ -508,6 +513,7 @@ int32 OS_SocketAddrInit(OS_SockAddr_t *Addr, OS_SocketDomain_t Domain) *-----------------------------------------------------------------*/ int32 OS_SocketAddrToString(char *buffer, size_t buflen, const OS_SockAddr_t *Addr) { + /* Check parameters */ OS_CHECK_POINTER(Addr); OS_CHECK_POINTER(buffer); OS_CHECK_SIZE(buflen); @@ -525,6 +531,7 @@ int32 OS_SocketAddrToString(char *buffer, size_t buflen, const OS_SockAddr_t *Ad *-----------------------------------------------------------------*/ int32 OS_SocketAddrFromString(OS_SockAddr_t *Addr, const char *string) { + /* Check parameters */ OS_CHECK_POINTER(Addr); OS_CHECK_POINTER(string); @@ -541,6 +548,7 @@ int32 OS_SocketAddrFromString(OS_SockAddr_t *Addr, const char *string) *-----------------------------------------------------------------*/ int32 OS_SocketAddrGetPort(uint16 *PortNum, const OS_SockAddr_t *Addr) { + /* Check parameters */ OS_CHECK_POINTER(Addr); OS_CHECK_POINTER(PortNum); @@ -557,6 +565,7 @@ int32 OS_SocketAddrGetPort(uint16 *PortNum, const OS_SockAddr_t *Addr) *-----------------------------------------------------------------*/ int32 OS_SocketAddrSetPort(OS_SockAddr_t *Addr, uint16 PortNum) { + /* Check parameters */ OS_CHECK_POINTER(Addr); return OS_SocketAddrSetPort_Impl(Addr, PortNum); diff --git a/src/os/shared/src/osapi-task.c b/src/os/shared/src/osapi-task.c index b46db2677..29c60dd4f 100644 --- a/src/os/shared/src/osapi-task.c +++ b/src/os/shared/src/osapi-task.c @@ -178,7 +178,11 @@ int32 OS_TaskCreate(osal_id_t *task_id, const char *task_name, osal_task_entry f OS_object_token_t token; OS_task_internal_record_t *task; - /* Check for NULL pointers */ + /* + * Check parameters + * + * Note "stack_pointer" is not checked, because in certain configurations it can be validly null. + */ OS_CHECK_POINTER(task_id); OS_CHECK_POINTER(function_pointer); OS_CHECK_APINAME(task_name); @@ -381,6 +385,7 @@ int32 OS_TaskGetIdByName(osal_id_t *task_id, const char *task_name) { int32 return_code; + /* Check parameters */ OS_CHECK_POINTER(task_id); OS_CHECK_POINTER(task_name); diff --git a/src/os/shared/src/osapi-time.c b/src/os/shared/src/osapi-time.c index 11e654caa..df92e6a58 100644 --- a/src/os/shared/src/osapi-time.c +++ b/src/os/shared/src/osapi-time.c @@ -59,7 +59,7 @@ OS_timecb_internal_record_t OS_timecb_table[OS_MAX_TIMERS]; typedef union { OS_TimerCallback_t timer_callback_func; - void *opaque_arg; + void * opaque_arg; } OS_Timer_ArgWrapper_t; /**************************************************************************************** @@ -106,7 +106,9 @@ static int32 OS_DoTimerAdd(osal_id_t *timer_id, const char *timer_name, osal_id_ OS_timebase_internal_record_t *timebase; /* - ** Check Parameters + * Check parameters + * + * Note "callback_arg" is not checked, because in certain configurations it can be validly null. */ OS_CHECK_POINTER(timer_id); OS_CHECK_APINAME(timer_name); @@ -127,8 +129,8 @@ static int32 OS_DoTimerAdd(osal_id_t *timer_id, const char *timer_name, osal_id_ * If successful, then after this statement, we MUST decrement the refcount * if we leave this routine with an error. */ - return_code = OS_ObjectIdGetById(OS_LOCK_MODE_REFCOUNT, OS_OBJECT_TYPE_OS_TIMEBASE, timebase_ref_id, - &timebase_token); + return_code = + OS_ObjectIdGetById(OS_LOCK_MODE_REFCOUNT, OS_OBJECT_TYPE_OS_TIMEBASE, timebase_ref_id, &timebase_token); if (return_code != OS_SUCCESS) { return return_code; @@ -163,14 +165,16 @@ static int32 OS_DoTimerAdd(osal_id_t *timer_id, const char *timer_name, osal_id_ */ OS_TimeBaseLock_Impl(&timebase_token); - if (OS_ObjectIdGetById(OS_LOCK_MODE_NONE, OS_OBJECT_TYPE_OS_TIMECB, timebase->first_cb, &listcb_token) == OS_SUCCESS) + if (OS_ObjectIdGetById(OS_LOCK_MODE_NONE, OS_OBJECT_TYPE_OS_TIMECB, timebase->first_cb, &listcb_token) == + OS_SUCCESS) { list_timecb = OS_OBJECT_TABLE_GET(OS_timecb_table, listcb_token); timecb->next_cb = OS_ObjectIdFromToken(&listcb_token); timecb->prev_cb = list_timecb->prev_cb; - if (OS_ObjectIdGetById(OS_LOCK_MODE_NONE, OS_OBJECT_TYPE_OS_TIMECB, timecb->prev_cb, &listcb_token) == OS_SUCCESS) + if (OS_ObjectIdGetById(OS_LOCK_MODE_NONE, OS_OBJECT_TYPE_OS_TIMECB, timecb->prev_cb, &listcb_token) == + OS_SUCCESS) { list_timecb->prev_cb = OS_ObjectIdFromToken(&timecb_token); list_timecb = OS_OBJECT_TABLE_GET(OS_timecb_table, listcb_token); @@ -236,8 +240,8 @@ static void OS_Timer_NoArgCallback(osal_id_t objid, void *arg) *-----------------------------------------------------------------*/ int32 OS_TimerCreate(osal_id_t *timer_id, const char *timer_name, uint32 *accuracy, OS_TimerCallback_t callback_ptr) { - int32 return_code; - osal_id_t timebase_ref_id; + int32 return_code; + osal_id_t timebase_ref_id; OS_Timer_ArgWrapper_t Conv; /* @@ -429,12 +433,14 @@ int32 OS_TimerDelete(osal_id_t timer_id) } } - if(OS_ObjectIdGetById(OS_LOCK_MODE_NONE,OS_OBJECT_TYPE_OS_TIMECB,timecb->prev_cb,&listcb_token) == OS_SUCCESS) + if (OS_ObjectIdGetById(OS_LOCK_MODE_NONE, OS_OBJECT_TYPE_OS_TIMECB, timecb->prev_cb, &listcb_token) == + OS_SUCCESS) { list_timecb = OS_OBJECT_TABLE_GET(OS_timecb_table, listcb_token); list_timecb->next_cb = timecb->next_cb; } - if(OS_ObjectIdGetById(OS_LOCK_MODE_NONE,OS_OBJECT_TYPE_OS_TIMECB,timecb->next_cb,&listcb_token) == OS_SUCCESS) + if (OS_ObjectIdGetById(OS_LOCK_MODE_NONE, OS_OBJECT_TYPE_OS_TIMECB, timecb->next_cb, &listcb_token) == + OS_SUCCESS) { list_timecb = OS_OBJECT_TABLE_GET(OS_timecb_table, listcb_token); list_timecb->prev_cb = timecb->prev_cb; @@ -478,6 +484,7 @@ int32 OS_TimerGetIdByName(osal_id_t *timer_id, const char *timer_name) int32 return_code; osal_objtype_t objtype; + /* Check parameters */ OS_CHECK_POINTER(timer_id); OS_CHECK_POINTER(timer_name); @@ -535,7 +542,7 @@ int32 OS_TimerGetInfo(osal_id_t timer_id, OS_timer_prop_t *timer_prop) timecb = OS_OBJECT_TABLE_GET(OS_timecb_table, token); timebase = OS_OBJECT_TABLE_GET(OS_timebase_table, timecb->timebase_token); - strncpy(timer_prop->name, record->name_entry, OS_MAX_API_NAME - 1); + strncpy(timer_prop->name, record->name_entry, sizeof(timer_prop->name) - 1); timer_prop->creator = record->creator; timer_prop->interval_time = (uint32)timecb->interval_time; timer_prop->accuracy = timebase->accuracy_usec; diff --git a/src/os/shared/src/osapi-timebase.c b/src/os/shared/src/osapi-timebase.c index affca25fb..a7918852a 100644 --- a/src/os/shared/src/osapi-timebase.c +++ b/src/os/shared/src/osapi-timebase.c @@ -263,6 +263,7 @@ int32 OS_TimeBaseGetIdByName(osal_id_t *timer_id, const char *timebase_name) int32 return_code; osal_objtype_t objtype; + /* Check parameters */ OS_CHECK_POINTER(timer_id); OS_CHECK_APINAME(timebase_name); @@ -318,7 +319,7 @@ int32 OS_TimeBaseGetInfo(osal_id_t timebase_id, OS_timebase_prop_t *timebase_pro record = OS_OBJECT_TABLE_GET(OS_global_timebase_table, token); timebase = OS_OBJECT_TABLE_GET(OS_timebase_table, token); - strncpy(timebase_prop->name, record->name_entry, OS_MAX_API_NAME - 1); + strncpy(timebase_prop->name, record->name_entry, sizeof(timebase_prop->name) - 1); timebase_prop->creator = record->creator; timebase_prop->nominal_interval_time = timebase->nominal_interval_time; timebase_prop->freerun_time = timebase->freerun_time; @@ -517,8 +518,9 @@ void OS_TimeBase_CallbackThread(osal_id_t timebase_id) } } - } while (OS_ObjectIdGetById(OS_LOCK_MODE_NONE, OS_OBJECT_TYPE_OS_TIMECB, timecb->next_cb, &cb_token) == OS_SUCCESS && - !OS_ObjectIdEqual(OS_ObjectIdFromToken(&cb_token), timebase->first_cb)); + } while (OS_ObjectIdGetById(OS_LOCK_MODE_NONE, OS_OBJECT_TYPE_OS_TIMECB, timecb->next_cb, &cb_token) == + OS_SUCCESS && + !OS_ObjectIdEqual(OS_ObjectIdFromToken(&cb_token), timebase->first_cb)); } OS_TimeBaseUnlock_Impl(&token); diff --git a/src/os/vxworks/inc/os-impl-binsem.h b/src/os/vxworks/inc/os-impl-binsem.h index 0cb2e426e..d18aa9a61 100644 --- a/src/os/vxworks/inc/os-impl-binsem.h +++ b/src/os/vxworks/inc/os-impl-binsem.h @@ -41,4 +41,4 @@ typedef struct /* Tables where the OS object information is stored */ extern OS_impl_binsem_internal_record_t OS_impl_bin_sem_table[OS_MAX_BIN_SEMAPHORES]; -#endif /* OS_IMPL_BINSEM_H */ +#endif /* OS_IMPL_BINSEM_H */ diff --git a/src/os/vxworks/inc/os-impl-console.h b/src/os/vxworks/inc/os-impl-console.h index 9941471b3..56d44993c 100644 --- a/src/os/vxworks/inc/os-impl-console.h +++ b/src/os/vxworks/inc/os-impl-console.h @@ -44,4 +44,4 @@ typedef struct extern OS_impl_console_internal_record_t OS_impl_console_table[OS_MAX_CONSOLES]; -#endif /* OS_IMPL_CONSOLE_H */ +#endif /* OS_IMPL_CONSOLE_H */ diff --git a/src/os/vxworks/inc/os-impl-countsem.h b/src/os/vxworks/inc/os-impl-countsem.h index 511f2513b..4d14393a2 100644 --- a/src/os/vxworks/inc/os-impl-countsem.h +++ b/src/os/vxworks/inc/os-impl-countsem.h @@ -41,4 +41,4 @@ typedef struct /* Tables where the OS object information is stored */ extern OS_impl_countsem_internal_record_t OS_impl_count_sem_table[OS_MAX_COUNT_SEMAPHORES]; -#endif /* OS_IMPL_COUNTSEM_H */ +#endif /* OS_IMPL_COUNTSEM_H */ diff --git a/src/os/vxworks/inc/os-impl-dirs.h b/src/os/vxworks/inc/os-impl-dirs.h index 9dc4447f7..5ae902ee2 100644 --- a/src/os/vxworks/inc/os-impl-dirs.h +++ b/src/os/vxworks/inc/os-impl-dirs.h @@ -42,7 +42,7 @@ * mkdir() in a consistent, POSIX compliant fashion. */ #ifdef OSAL_VXWORKS6_COMPATIBILITY -#define mkdir(path,mode) mkdir(path) +#define mkdir(path, mode) mkdir(path) #endif typedef struct @@ -55,4 +55,4 @@ typedef struct */ extern OS_impl_dir_internal_record_t OS_impl_dir_table[OS_MAX_NUM_OPEN_DIRS]; -#endif /* OS_IMPL_DIRS_H */ +#endif /* OS_IMPL_DIRS_H */ diff --git a/src/os/vxworks/inc/os-impl-files.h b/src/os/vxworks/inc/os-impl-files.h index 29461d94b..64378a043 100644 --- a/src/os/vxworks/inc/os-impl-files.h +++ b/src/os/vxworks/inc/os-impl-files.h @@ -47,4 +47,4 @@ */ #define OS_IMPL_REGULAR_FILE_FLAGS 0 -#endif /* OS_IMPL_FILES_H */ +#endif /* OS_IMPL_FILES_H */ diff --git a/src/os/vxworks/inc/os-impl-filesys.h b/src/os/vxworks/inc/os-impl-filesys.h index d39863f6f..b376ef0fa 100644 --- a/src/os/vxworks/inc/os-impl-filesys.h +++ b/src/os/vxworks/inc/os-impl-filesys.h @@ -42,4 +42,4 @@ typedef struct extern OS_impl_filesys_internal_record_t OS_impl_filesys_table[OS_MAX_FILE_SYSTEMS]; -#endif /* OS_IMPL_FILESYS_H */ +#endif /* OS_IMPL_FILESYS_H */ diff --git a/src/os/vxworks/inc/os-impl-gettime.h b/src/os/vxworks/inc/os-impl-gettime.h index a24a37ccf..5a66cabd9 100644 --- a/src/os/vxworks/inc/os-impl-gettime.h +++ b/src/os/vxworks/inc/os-impl-gettime.h @@ -33,4 +33,4 @@ #define OSAL_GETTIME_SOURCE_CLOCK CLOCK_MONOTONIC -#endif /* OS_IMPL_GETTIME_H */ +#endif /* OS_IMPL_GETTIME_H */ diff --git a/src/os/vxworks/inc/os-impl-idmap.h b/src/os/vxworks/inc/os-impl-idmap.h index a8e47a580..2e2098a31 100644 --- a/src/os/vxworks/inc/os-impl-idmap.h +++ b/src/os/vxworks/inc/os-impl-idmap.h @@ -41,4 +41,4 @@ typedef struct /* Tables where the lock state information is stored */ extern OS_impl_objtype_lock_t *const OS_impl_objtype_lock_table[OS_OBJECT_TYPE_USER]; -#endif /* OS_IMPL_IDMAP_H */ +#endif /* OS_IMPL_IDMAP_H */ diff --git a/src/os/vxworks/inc/os-impl-io.h b/src/os/vxworks/inc/os-impl-io.h index e0ee37baa..0968588f6 100644 --- a/src/os/vxworks/inc/os-impl-io.h +++ b/src/os/vxworks/inc/os-impl-io.h @@ -55,4 +55,4 @@ extern OS_impl_file_internal_record_t OS_impl_filehandle_table[OS_MAX_NUM_OPEN_F */ #define GENERIC_IO_CONST_DATA_CAST (void *) -#endif /* OS_IMPL_IO_H */ +#endif /* OS_IMPL_IO_H */ diff --git a/src/os/vxworks/inc/os-impl-loader.h b/src/os/vxworks/inc/os-impl-loader.h index 031899364..3093c6e5d 100644 --- a/src/os/vxworks/inc/os-impl-loader.h +++ b/src/os/vxworks/inc/os-impl-loader.h @@ -51,4 +51,4 @@ typedef struct */ extern OS_impl_module_internal_record_t OS_impl_module_table[OS_MAX_MODULES]; -#endif /* OS_IMPL_LOADER_H */ +#endif /* OS_IMPL_LOADER_H */ diff --git a/src/os/vxworks/inc/os-impl-mutex.h b/src/os/vxworks/inc/os-impl-mutex.h index 45b286429..08bb6b388 100644 --- a/src/os/vxworks/inc/os-impl-mutex.h +++ b/src/os/vxworks/inc/os-impl-mutex.h @@ -40,4 +40,4 @@ typedef struct /* Tables where the OS object information is stored */ extern OS_impl_mutsem_internal_record_t OS_impl_mutex_table[OS_MAX_MUTEXES]; -#endif /* OS_IMPL_MUTEX_H */ +#endif /* OS_IMPL_MUTEX_H */ diff --git a/src/os/vxworks/inc/os-impl-network.h b/src/os/vxworks/inc/os-impl-network.h index 482ddbdb9..4b473c856 100644 --- a/src/os/vxworks/inc/os-impl-network.h +++ b/src/os/vxworks/inc/os-impl-network.h @@ -36,4 +36,4 @@ #include #include -#endif /* OS_IMPL_NETWORK_H */ +#endif /* OS_IMPL_NETWORK_H */ diff --git a/src/os/vxworks/inc/os-impl-queues.h b/src/os/vxworks/inc/os-impl-queues.h index 6305af6e8..d82a7affe 100644 --- a/src/os/vxworks/inc/os-impl-queues.h +++ b/src/os/vxworks/inc/os-impl-queues.h @@ -39,4 +39,4 @@ typedef struct /* Tables where the OS object information is stored */ extern OS_impl_queue_internal_record_t OS_impl_queue_table[OS_MAX_QUEUES]; -#endif /* OS_IMPL_QUEUES_H */ +#endif /* OS_IMPL_QUEUES_H */ diff --git a/src/os/vxworks/inc/os-impl-select.h b/src/os/vxworks/inc/os-impl-select.h index 338814f5e..d29b5d8e5 100644 --- a/src/os/vxworks/inc/os-impl-select.h +++ b/src/os/vxworks/inc/os-impl-select.h @@ -31,4 +31,4 @@ #include "os-impl-io.h" #include -#endif /* OS_IMPL_SELECT_H */ +#endif /* OS_IMPL_SELECT_H */ diff --git a/src/os/vxworks/inc/os-impl-sockets.h b/src/os/vxworks/inc/os-impl-sockets.h index cf7732093..32dbabea2 100644 --- a/src/os/vxworks/inc/os-impl-sockets.h +++ b/src/os/vxworks/inc/os-impl-sockets.h @@ -46,4 +46,4 @@ /* The "in.h" header file supplied in VxWorks 6.9 is missing the "in_port_t" typedef */ typedef u_short in_port_t; -#endif /* OS_IMPL_SOCKETS_H */ +#endif /* OS_IMPL_SOCKETS_H */ diff --git a/src/os/vxworks/inc/os-impl-symtab.h b/src/os/vxworks/inc/os-impl-symtab.h index 5dab5df28..037207385 100644 --- a/src/os/vxworks/inc/os-impl-symtab.h +++ b/src/os/vxworks/inc/os-impl-symtab.h @@ -44,4 +44,4 @@ extern SymbolDumpState_t OS_VxWorks_SymbolDumpState; BOOL OS_SymTableIterator_Impl(char *name, SYM_VALUE val, SYM_TYPE type, _Vx_usr_arg_t arg, SYM_GROUP group); -#endif /* OS_IMPL_SYMTAB_H */ +#endif /* OS_IMPL_SYMTAB_H */ diff --git a/src/os/vxworks/inc/os-impl-tasks.h b/src/os/vxworks/inc/os-impl-tasks.h index 213ced273..12ef8f726 100644 --- a/src/os/vxworks/inc/os-impl-tasks.h +++ b/src/os/vxworks/inc/os-impl-tasks.h @@ -43,12 +43,12 @@ typedef WIND_TCB OS_VxWorks_TCB_t; typedef struct { OS_VxWorks_TCB_t tcb; /* Must be first */ - TASK_ID vxid; - void *heap_block; /* set non-null if the stack was obtained with malloc() */ - size_t heap_block_size; + TASK_ID vxid; + void * heap_block; /* set non-null if the stack was obtained with malloc() */ + size_t heap_block_size; } OS_impl_task_internal_record_t; /* Tables where the OS object information is stored */ extern OS_impl_task_internal_record_t OS_impl_task_table[OS_MAX_TASKS]; -#endif /* OS_IMPL_TASKS_H */ +#endif /* OS_IMPL_TASKS_H */ diff --git a/src/os/vxworks/inc/os-impl-timebase.h b/src/os/vxworks/inc/os-impl-timebase.h index 559ca2e3e..72dbd22ba 100644 --- a/src/os/vxworks/inc/os-impl-timebase.h +++ b/src/os/vxworks/inc/os-impl-timebase.h @@ -61,4 +61,4 @@ typedef struct extern OS_impl_timebase_internal_record_t OS_impl_timebase_table[OS_MAX_TIMEBASES]; -#endif /* OS_IMPL_TIMEBASE_H */ +#endif /* OS_IMPL_TIMEBASE_H */ diff --git a/src/os/vxworks/inc/os-vxworks.h b/src/os/vxworks/inc/os-vxworks.h index 4d9e1eefd..da6b8da22 100644 --- a/src/os/vxworks/inc/os-vxworks.h +++ b/src/os/vxworks/inc/os-vxworks.h @@ -82,4 +82,4 @@ int32 OS_VxWorks_GenericSemGive(SEM_ID vxid); int32 OS_VxWorks_TableMutex_Init(osal_objtype_t idtype); -#endif /* OS_VXWORKS_H */ +#endif /* OS_VXWORKS_H */ diff --git a/src/os/vxworks/src/os-impl-dirs-globals.c b/src/os/vxworks/src/os-impl-dirs-globals.c index 7be3ab73a..aa53a3585 100644 --- a/src/os/vxworks/src/os-impl-dirs-globals.c +++ b/src/os/vxworks/src/os-impl-dirs-globals.c @@ -33,13 +33,11 @@ #include "os-impl-dirs.h" #include "os-shared-dir.h" - /* * The directory handle table. */ OS_impl_dir_internal_record_t OS_impl_dir_table[OS_MAX_NUM_OPEN_DIRS]; - /*---------------------------------------------------------------- * * Function: OS_VxWorks_DirAPI_Impl_Init @@ -49,7 +47,6 @@ OS_impl_dir_internal_record_t OS_impl_dir_table[OS_MAX_NUM_OPEN_DIRS]; *-----------------------------------------------------------------*/ int32 OS_VxWorks_DirAPI_Impl_Init(void) { - memset(OS_impl_dir_table, 0, sizeof(OS_impl_dir_table)); - return OS_SUCCESS; + memset(OS_impl_dir_table, 0, sizeof(OS_impl_dir_table)); + return OS_SUCCESS; } /* end OS_VxWorks_DirAPI_Impl_Init */ - diff --git a/src/os/vxworks/src/os-impl-idmap.c b/src/os/vxworks/src/os-impl-idmap.c index 503d8f7f5..a8da5bd2d 100644 --- a/src/os/vxworks/src/os-impl-idmap.c +++ b/src/os/vxworks/src/os-impl-idmap.c @@ -60,57 +60,20 @@ VX_MUTEX_SEMAPHORE(OS_module_table_mut_mem); VX_MUTEX_SEMAPHORE(OS_filesys_table_mut_mem); VX_MUTEX_SEMAPHORE(OS_console_table_mut_mem); -static OS_impl_objtype_lock_t OS_task_table_lock = -{ - .mem = OS_task_table_mut_mem -}; -static OS_impl_objtype_lock_t OS_queue_table_lock = -{ - .mem = OS_queue_table_mut_mem -}; -static OS_impl_objtype_lock_t OS_bin_sem_table_lock = -{ - .mem = OS_bin_sem_table_mut_mem -}; -static OS_impl_objtype_lock_t OS_mutex_table_lock = -{ - .mem = OS_mutex_table_mut_mem -}; -static OS_impl_objtype_lock_t OS_count_sem_table_lock = -{ - .mem = OS_count_sem_table_mut_mem -}; -static OS_impl_objtype_lock_t OS_stream_table_lock = -{ - .mem = OS_stream_table_mut_mem -}; -static OS_impl_objtype_lock_t OS_dir_table_lock = -{ - .mem = OS_dir_table_mut_mem -}; -static OS_impl_objtype_lock_t OS_timebase_table_lock = -{ - .mem = OS_timebase_table_mut_mem -}; -static OS_impl_objtype_lock_t OS_timecb_table_lock = -{ - .mem = OS_timecb_table_mut_mem -}; -static OS_impl_objtype_lock_t OS_module_table_lock = -{ - .mem = OS_module_table_mut_mem -}; -static OS_impl_objtype_lock_t OS_filesys_table_lock = -{ - .mem = OS_filesys_table_mut_mem -}; -static OS_impl_objtype_lock_t OS_console_table_lock = -{ - .mem = OS_console_table_mut_mem -}; - -OS_impl_objtype_lock_t * const OS_impl_objtype_lock_table[OS_OBJECT_TYPE_USER] = -{ +static OS_impl_objtype_lock_t OS_task_table_lock = {.mem = OS_task_table_mut_mem}; +static OS_impl_objtype_lock_t OS_queue_table_lock = {.mem = OS_queue_table_mut_mem}; +static OS_impl_objtype_lock_t OS_bin_sem_table_lock = {.mem = OS_bin_sem_table_mut_mem}; +static OS_impl_objtype_lock_t OS_mutex_table_lock = {.mem = OS_mutex_table_mut_mem}; +static OS_impl_objtype_lock_t OS_count_sem_table_lock = {.mem = OS_count_sem_table_mut_mem}; +static OS_impl_objtype_lock_t OS_stream_table_lock = {.mem = OS_stream_table_mut_mem}; +static OS_impl_objtype_lock_t OS_dir_table_lock = {.mem = OS_dir_table_mut_mem}; +static OS_impl_objtype_lock_t OS_timebase_table_lock = {.mem = OS_timebase_table_mut_mem}; +static OS_impl_objtype_lock_t OS_timecb_table_lock = {.mem = OS_timecb_table_mut_mem}; +static OS_impl_objtype_lock_t OS_module_table_lock = {.mem = OS_module_table_mut_mem}; +static OS_impl_objtype_lock_t OS_filesys_table_lock = {.mem = OS_filesys_table_mut_mem}; +static OS_impl_objtype_lock_t OS_console_table_lock = {.mem = OS_console_table_mut_mem}; + +OS_impl_objtype_lock_t *const OS_impl_objtype_lock_table[OS_OBJECT_TYPE_USER] = { [OS_OBJECT_TYPE_UNDEFINED] = NULL, [OS_OBJECT_TYPE_OS_TASK] = &OS_task_table_lock, [OS_OBJECT_TYPE_OS_QUEUE] = &OS_queue_table_lock, @@ -123,8 +86,7 @@ OS_impl_objtype_lock_t * const OS_impl_objtype_lock_table[OS_OBJECT_TYPE_USER] = [OS_OBJECT_TYPE_OS_TIMECB] = &OS_timecb_table_lock, [OS_OBJECT_TYPE_OS_MODULE] = &OS_module_table_lock, [OS_OBJECT_TYPE_OS_FILESYS] = &OS_filesys_table_lock, - [OS_OBJECT_TYPE_OS_CONSOLE] = &OS_console_table_lock -}; + [OS_OBJECT_TYPE_OS_CONSOLE] = &OS_console_table_lock}; /*---------------------------------------------------------------- * @@ -190,11 +152,10 @@ void OS_WaitForStateChange_Impl(osal_objtype_t idtype, uint32 attempts) } OS_Unlock_Global_Impl(idtype); - taskDelay(wait_ticks); - OS_Lock_Global_Impl(idtype); + taskDelay(wait_ticks); + OS_Lock_Global_Impl(idtype); } - /**************************************************************************************** INITIALIZATION FUNCTION ****************************************************************************************/ @@ -210,7 +171,7 @@ void OS_WaitForStateChange_Impl(osal_objtype_t idtype, uint32 attempts) int32 OS_VxWorks_TableMutex_Init(osal_objtype_t idtype) { OS_impl_objtype_lock_t *impl; - SEM_ID semid; + SEM_ID semid; impl = OS_impl_objtype_lock_table[idtype]; if (impl == NULL) diff --git a/src/os/vxworks/src/os-impl-shell.c b/src/os/vxworks/src/os-impl-shell.c index 7fc9f3342..4401c9867 100644 --- a/src/os/vxworks/src/os-impl-shell.c +++ b/src/os/vxworks/src/os-impl-shell.c @@ -34,6 +34,7 @@ #include "os-shared-shell.h" #include "os-shared-file.h" #include "os-shared-idmap.h" +#include "os-shared-common.h" #include #include @@ -78,12 +79,12 @@ int32 OS_ShellOutputToFile_Impl(const OS_object_token_t *token, const char *Cmd) cmd_impl = OS_OBJECT_TABLE_GET(OS_impl_filehandle_table, cmd_token); /* copy the command to the file, and then seek back to the beginning of the file */ - OS_write(fdCmd, Cmd, strlen(Cmd)); + OS_write(fdCmd, Cmd, OS_strnlen(Cmd, OS_MAX_CMD_LEN)); OS_lseek(fdCmd, 0, OS_SEEK_SET); /* Create a shell task the will run the command in the file, push output to OS_fd */ - Result = shellGenericInit("INTERPRETER=Cmd", 0, NULL, &shellName, false, false, - cmd_impl->fd, out_impl->fd, out_impl->fd); + Result = shellGenericInit("INTERPRETER=Cmd", 0, NULL, &shellName, false, false, cmd_impl->fd, out_impl->fd, + out_impl->fd); } if (Result == OK) diff --git a/src/os/vxworks/src/os-impl-symtab.c b/src/os/vxworks/src/os-impl-symtab.c index 5dc9f94ee..ed4244761 100644 --- a/src/os/vxworks/src/os-impl-symtab.c +++ b/src/os/vxworks/src/os-impl-symtab.c @@ -172,7 +172,7 @@ BOOL OS_SymTableIterator_Impl(char *name, SYM_VALUE val, SYM_TYPE type, _Vx_usr_ */ state = &OS_VxWorks_SymbolDumpState; - if (strlen(name) >= OS_MAX_SYM_LEN) + if (memchr(name, 0, OS_MAX_SYM_LEN) == NULL) { OS_DEBUG("%s(): symbol name too long\n", __func__); state->StatusCode = OS_ERROR; @@ -196,7 +196,8 @@ BOOL OS_SymTableIterator_Impl(char *name, SYM_VALUE val, SYM_TYPE type, _Vx_usr_ /* ** Copy symbol name */ - strncpy(symRecord.SymbolName, name, OS_MAX_SYM_LEN); + strncpy(symRecord.SymbolName, name, sizeof(symRecord.SymbolName) - 1); + symRecord.SymbolName[sizeof(symRecord.SymbolName) - 1] = 0; /* ** Save symbol address diff --git a/src/os/vxworks/src/os-impl-tasks.c b/src/os/vxworks/src/os-impl-tasks.c index 060454817..2f6ebfed4 100644 --- a/src/os/vxworks/src/os-impl-tasks.c +++ b/src/os/vxworks/src/os-impl-tasks.c @@ -234,7 +234,7 @@ int32 OS_TaskCreate_Impl(const OS_object_token_t *token, uint32 flags) actualstackbase += actualsz; /* move to last byte of stack block */ #endif - status = taskInit((WIND_TCB*)&lrec->tcb, /* address of new task's TCB */ + status = taskInit((WIND_TCB *)&lrec->tcb, /* address of new task's TCB */ (char *)task->task_name, vxpri, /* priority of new task */ vxflags, /* task option word */ (char *)actualstackbase, /* base of new task's stack */ @@ -414,7 +414,7 @@ int32 OS_TaskRegister_Impl(osal_id_t global_task_id) *-----------------------------------------------------------------*/ osal_id_t OS_TaskGetId_Impl(void) { - void *lrec; + void * lrec; size_t idx; osal_id_t id; diff --git a/src/os/vxworks/src/os-impl-timebase.c b/src/os/vxworks/src/os-impl-timebase.c index 887bf64b8..235413179 100644 --- a/src/os/vxworks/src/os-impl-timebase.c +++ b/src/os/vxworks/src/os-impl-timebase.c @@ -218,10 +218,10 @@ void OS_VxWorks_RegisterTimer(osal_id_t obj_id) OS_object_token_t token; struct sigevent evp; int status; - int32 retcode; + int32 retcode; retcode = OS_ObjectIdGetById(OS_LOCK_MODE_RESERVED, OS_OBJECT_TYPE_OS_TIMEBASE, obj_id, &token); - if (retcode == OS_SUCCESS) + if (retcode == OS_SUCCESS) { local = OS_OBJECT_TABLE_GET(OS_impl_timebase_table, token); @@ -251,12 +251,12 @@ void OS_VxWorks_RegisterTimer(osal_id_t obj_id) local->timer_state = OS_TimerRegState_SUCCESS; } - OS_ObjectIdRelease(&token); + OS_ObjectIdRelease(&token); + } + else + { + OS_DEBUG("OS_VxWorks_RegisterTimer() bad ID, code=%d\n", (int)retcode); } - else - { - OS_DEBUG("OS_VxWorks_RegisterTimer() bad ID, code=%d\n", (int)retcode); - } } /* end OS_VxWorks_RegisterTimer */ /**************************************************************************************** @@ -462,9 +462,9 @@ int32 OS_TimeBaseCreate_Impl(const OS_object_token_t *token) { local->handler_task = taskSpawn(timebase->timebase_name, OSAL_TIMEBASE_TASK_PRIORITY, /* priority */ OSAL_TIMEBASE_TASK_OPTION_WORD, /* task option word */ - OSAL_TIMEBASE_TASK_STACK_SIZE, /* size (bytes) of stack needed */ - (FUNCPTR)OS_VxWorks_TimeBaseTask, /* Timebase helper task entry point */ - OS_ObjectIdToInteger(OS_ObjectIdFromToken(token)), /* 1st arg is ID */ + OSAL_TIMEBASE_TASK_STACK_SIZE, /* size (bytes) of stack needed */ + (FUNCPTR)OS_VxWorks_TimeBaseTask, /* Timebase helper task entry point */ + OS_ObjectIdToInteger(OS_ObjectIdFromToken(token)), /* 1st arg is ID */ 0, 0, 0, 0, 0, 0, 0, 0, 0); /* check if taskSpawn failed */ @@ -566,8 +566,8 @@ int32 OS_TimeBaseSet_Impl(const OS_object_token_t *token, uint32 start_time, uin if (status == OK) { local->configured_start_time = (timeout.it_value.tv_sec * 1000000) + (timeout.it_value.tv_nsec / 1000); - local->configured_interval_time = (timeout.it_interval.tv_sec * 1000000) + - (timeout.it_interval.tv_nsec / 1000); + local->configured_interval_time = + (timeout.it_interval.tv_sec * 1000000) + (timeout.it_interval.tv_nsec / 1000); if (local->configured_start_time != start_time) { diff --git a/src/tests/file-api-test/file-api-test.c b/src/tests/file-api-test/file-api-test.c index 6d4a41d87..b82867782 100644 --- a/src/tests/file-api-test/file-api-test.c +++ b/src/tests/file-api-test/file-api-test.c @@ -246,53 +246,62 @@ void TestOpenClose(void) ---------------------------------------------------------------------------------------*/ void TestChmod(void) { - char filename[OS_MAX_PATH_LEN]; + char filename[OS_MAX_PATH_LEN]; int32 status; osal_id_t fd; /*Make a file to test on. Start in Read only mode */ strncpy(filename, "/drive0/Filename1", sizeof(filename) - 1); filename[sizeof(filename) - 1] = 0; - status = OS_OpenCreate(&fd, filename, OS_FILE_FLAG_CREATE , OS_READ_WRITE); + status = OS_OpenCreate(&fd, filename, OS_FILE_FLAG_CREATE, OS_READ_WRITE); UtAssert_True(status >= OS_SUCCESS, "status after creat = %d", (int)status); status = OS_close(fd); UtAssert_True(status == OS_SUCCESS, "status after close = %d", (int)status); /*Testing Write Only */ status = OS_chmod(filename, OS_WRITE_ONLY); - if(status != OS_ERR_NOT_IMPLEMENTED){ + if (status != OS_ERR_NOT_IMPLEMENTED) + { UtAssert_True(status == OS_SUCCESS, "status after chmod = %d", (int)status); status = OS_OpenCreate(&fd, filename, OS_FILE_FLAG_NONE, OS_WRITE_ONLY); UtAssert_True(status >= OS_SUCCESS, "status after reopen = %d", (int)status); status = OS_close(fd); UtAssert_True(status == OS_SUCCESS, "status after close = %d", (int)status); - }else{ - UtPrintf("OS_chmod not implemented for write only\n"); - } + } + else + { + UtPrintf("OS_chmod not implemented for write only\n"); + } /*Testing Read Only */ status = OS_chmod(filename, OS_READ_ONLY); - if(status != OS_ERR_NOT_IMPLEMENTED){ + if (status != OS_ERR_NOT_IMPLEMENTED) + { UtAssert_True(status == OS_SUCCESS, "status after chmod = %d", (int)status); status = OS_OpenCreate(&fd, filename, OS_FILE_FLAG_NONE, OS_READ_ONLY); UtAssert_True(status >= OS_SUCCESS, "status after reopen = %d", (int)status); status = OS_close(fd); - UtAssert_True(status == OS_SUCCESS, "status after close = %d", (int)status); - }else{ + UtAssert_True(status == OS_SUCCESS, "status after close = %d", (int)status); + } + else + { UtPrintf("OS_chmod not implemented for read only\n"); - } + } /*Testing Read Write */ status = OS_chmod(filename, OS_READ_WRITE); - if(status != OS_ERR_NOT_IMPLEMENTED){ + if (status != OS_ERR_NOT_IMPLEMENTED) + { UtAssert_True(status == OS_SUCCESS, "status after chmod = %d", (int)status); status = OS_OpenCreate(&fd, filename, OS_FILE_FLAG_NONE, OS_READ_WRITE); UtAssert_True(status >= OS_SUCCESS, "status after reopen = %d", (int)status); status = OS_close(fd); - UtAssert_True(status == OS_SUCCESS, "status after close = %d", (int)status); - }else{ + UtAssert_True(status == OS_SUCCESS, "status after close = %d", (int)status); + } + else + { UtPrintf("OS_chmod not implemented for read write\n"); - } + } /*Removing the file */ status = OS_remove(filename); @@ -453,8 +462,8 @@ void TestMkRmDirFreeBytes(void) /* NOTE: The blocks free call is not necessarily implemented on all filesystems. * So the response of OS_ERR_NOT_IMPLEMENTED is acceptable. */ status = OS_FileSysStatVolume("/drive0", &statbuf); - UtAssert_True(status == OS_ERR_NOT_IMPLEMENTED || status == OS_SUCCESS, "Checking Free Blocks: status=%d blocks=%lu", - (int)status, (unsigned long)statbuf.blocks_free); + UtAssert_True(status == OS_ERR_NOT_IMPLEMENTED || status == OS_SUCCESS, + "Checking Free Blocks: status=%d blocks=%lu", (int)status, (unsigned long)statbuf.blocks_free); /* make the two directories */ status = OS_mkdir(dir1, 0); @@ -490,8 +499,8 @@ void TestMkRmDirFreeBytes(void) memset(buffer1, 0, sizeof(buffer1)); memset(buffer2, 0, sizeof(buffer2)); status = OS_FileSysStatVolume("/drive0", &statbuf); - UtAssert_True(status == OS_ERR_NOT_IMPLEMENTED || status == OS_SUCCESS, "Checking Free Blocks: status=%d blocks=%lu", - (int)status, (unsigned long)statbuf.blocks_free); + UtAssert_True(status == OS_ERR_NOT_IMPLEMENTED || status == OS_SUCCESS, + "Checking Free Blocks: status=%d blocks=%lu", (int)status, (unsigned long)statbuf.blocks_free); /* read back out of the files what we wrote into them */ size = strlen(copybuffer1); @@ -531,8 +540,8 @@ void TestMkRmDirFreeBytes(void) UtAssert_True(status == OS_SUCCESS, "status after rmdir 2 = %d", (int)status); status = OS_FileSysStatVolume("/drive0", &statbuf); - UtAssert_True(status == OS_ERR_NOT_IMPLEMENTED || status == OS_SUCCESS, "Checking Free Blocks: status=%d blocks=%lu", - (int)status, (unsigned long)statbuf.blocks_free); + UtAssert_True(status == OS_ERR_NOT_IMPLEMENTED || status == OS_SUCCESS, + "Checking Free Blocks: status=%d blocks=%lu", (int)status, (unsigned long)statbuf.blocks_free); } /*--------------------------------------------------------------------------------------- @@ -951,5 +960,4 @@ void TestOpenFileAPI(void) UtAssert_True(status == OS_SUCCESS, "status after remove filename2 = %d", (int)status); status = OS_remove(filename3); UtAssert_True(status == OS_SUCCESS, "status after remove filename3 = %d", (int)status); - } diff --git a/src/tests/osal-core-test/osal-core-test.c b/src/tests/osal-core-test/osal-core-test.c index bef1e07d4..79593e653 100644 --- a/src/tests/osal-core-test/osal-core-test.c +++ b/src/tests/osal-core-test/osal-core-test.c @@ -68,13 +68,13 @@ osal_id_t msgq_2; osal_id_t msgq_3; osal_id_t bin_0; -osal_id_t bin_1; +osal_id_t bin_1; osal_id_t bin_2; osal_id_t bin_3; osal_id_t mut_0; -osal_id_t mut_1; -osal_id_t mut_2; +osal_id_t mut_1; +osal_id_t mut_2; osal_id_t mut_3; /* helper function for "OS_ForEachObject" test cases */ @@ -142,8 +142,6 @@ void TestTasks(void) OS_task_prop_t taskprop; int loopcnt; - /* OS_TaskRegister(); */ - /* Testing Creating up to OS_MAX_TASKS, plus one more */ memset(TaskData, 0xFF, sizeof(TaskData)); for (tasknum = 0; tasknum < (OS_MAX_TASKS + 1); ++tasknum) @@ -221,41 +219,34 @@ void TestTasks(void) InitializeTaskIds(); /* Create Task 0 again */ - status = OS_TaskCreate(&task_0_id, "Task 0", task_generic_no_exit, OSAL_STACKPTR_C(task_0_stack), sizeof(task_0_stack), - OSAL_PRIORITY_C(TASK_0_PRIORITY), 0); - /*UtDebug("Create Status = %d, Id = %d\n",status,task_0_id); */ + status = OS_TaskCreate(&task_0_id, "Task 0", task_generic_no_exit, OSAL_STACKPTR_C(task_0_stack), + sizeof(task_0_stack), OSAL_PRIORITY_C(TASK_0_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "OS_TaskCreate, recreate 0"); /* Try and create another "Task 0", should fail as we already have one named "Task 0" */ - status = OS_TaskCreate(&task_1_id, "Task 0", task_generic_no_exit, OSAL_STACKPTR_C(task_0_stack), sizeof(task_0_stack), - OSAL_PRIORITY_C(TASK_0_PRIORITY), 0); + status = OS_TaskCreate(&task_1_id, "Task 0", task_generic_no_exit, OSAL_STACKPTR_C(task_0_stack), + sizeof(task_0_stack), OSAL_PRIORITY_C(TASK_0_PRIORITY), 0); UtAssert_True(status != OS_SUCCESS, "OS_TaskCreate, dupe name 0"); - status = OS_TaskCreate(&task_2_id, "Task 2", task_generic_no_exit, OSAL_STACKPTR_C(task_2_stack), sizeof(task_2_stack), - OSAL_PRIORITY_C(TASK_2_PRIORITY), 0); - /* UtDebug("Create Status = %d, Id = %d\n",status,task_2_id); */ + status = OS_TaskCreate(&task_2_id, "Task 2", task_generic_no_exit, OSAL_STACKPTR_C(task_2_stack), + sizeof(task_2_stack), OSAL_PRIORITY_C(TASK_2_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "OS_TaskCreate, recreate 2"); - status = OS_TaskCreate(&task_3_id, "Task 3", task_generic_no_exit, OSAL_STACKPTR_C(task_3_stack), sizeof(task_3_stack), - OSAL_PRIORITY_C(TASK_3_PRIORITY), 0); - /* UtDebug("Create Status = %d, Id = %d\n",status,task_3_id); */ + status = OS_TaskCreate(&task_3_id, "Task 3", task_generic_no_exit, OSAL_STACKPTR_C(task_3_stack), + sizeof(task_3_stack), OSAL_PRIORITY_C(TASK_3_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "OS_TaskCreate, recreate 3"); status = OS_TaskGetIdByName(&task_0_id, "Task 0"); - /* UtDebug("Satus after Getting the id of \"Task 0\":%d,%d \n\n",status,task_0_id); */ /*first newly created task should have id == 0*/ UtAssert_True(status == OS_SUCCESS, "OS_TaskGetIdByName, Task 0"); status = OS_TaskGetIdByName(&task_1_id, "Task 1"); - /*UtDebug("Satus after Getting the id of \"Task 1\":%d,%d \n\n",status,task_1_id);*/ UtAssert_True(status != OS_SUCCESS, "OS_TaskGetIdByName, Task 1"); status = OS_TaskGetIdByName(&task_2_id, "Task 2"); - /* UtDebug("Satus after Getting the id of \"Task 2\":%d,%d \n\n",status,task_2_id);*/ UtAssert_True(status == OS_SUCCESS, "OS_TaskGetIdByName, Task 2"); status = OS_TaskGetIdByName(&task_3_id, "Task 3"); - /* UtDebug("Satus after Getting the id of \"Task 3\":%d,%d \n\n",status,task_3_id); */ UtAssert_True(status == OS_SUCCESS, "OS_TaskGetIdByName, Task 3"); /* @@ -308,20 +299,16 @@ void TestQueues(void) InitializeQIds(); status = OS_QueueCreate(&msgq_0, "q 0", OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); - /* UtDebug("Status after Creating q 0: %d,%d\n",status,msgq_0);*/ UtAssert_True(status == OS_SUCCESS, "OS_QueueCreate, recreate 0"); /* This one should fail */ status = OS_QueueCreate(&msgq_1, "q 0", OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); - /* UtDebug("Status after Creating q 0 again: %d,%d\n",status,msgq_1); */ UtAssert_True(status != OS_SUCCESS, "OS_QueueCreate, dupe name 0"); status = OS_QueueCreate(&msgq_2, "q 2", OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); - /* UtDebug("Status after Creating q 2: %d,%d\n",status,msgq_2); */ UtAssert_True(status == OS_SUCCESS, "OS_QueueCreate, recreate 2"); status = OS_QueueCreate(&msgq_3, "q 3", OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); - /* UtDebug("Status after Creating q 3: %d,%d\n",status,msgq_3); */ UtAssert_True(status == OS_SUCCESS, "OS_QueueCreate, recreate 3"); /* @@ -349,19 +336,15 @@ void TestQueues(void) /* Time to Delete the Queues we just created */ status = OS_QueueDelete(msgq_0); - /* UtDebug("Status after Deleting q 0 : %d\n",status); */ UtAssert_True(status == OS_SUCCESS, "OS_QueueDelete, q 0"); status = OS_QueueDelete(msgq_1); - /* UtDebug("Status after Deleting q 1: %d\n",status); */ UtAssert_True(status != OS_SUCCESS, "OS_QueueDelete, q 1"); status = OS_QueueDelete(msgq_2); - /* UtDebug("Status after Deleting q 2: %d\n",status); */ UtAssert_True(status == OS_SUCCESS, "OS_QueueDelete, q 2"); status = OS_QueueDelete(msgq_3); - /* UtDebug("Status after Deleting q 3: %d\n",status); */ UtAssert_True(status == OS_SUCCESS, "OS_QueueDelete, q 3"); } /* end TestQueues */ @@ -404,35 +387,27 @@ void TestBinaries(void) */ InitializeBinIds(); status = OS_BinSemCreate(&bin_0, "Bin 0", OS_SEM_FULL, 0); - /* UtDebug("Status after creating: %d,%d\n",status,bin_0); */ UtAssert_True(status == OS_SUCCESS, "OS_BinSemCreate, recreate 0"); status = OS_BinSemCreate(&bin_1, "Bin 0", OS_SEM_FULL, 0); - /* UtDebug("Status after creating: %d,%d\n",status,bin_1); */ UtAssert_True(status != OS_SUCCESS, "OS_BinSemCreate, dupe name 0"); status = OS_BinSemCreate(&bin_2, "Bin 2", OS_SEM_EMPTY, 0); - /* UtDebug("Status after creating: %d,%d\n",status,bin_2); */ UtAssert_True(status == OS_SUCCESS, "OS_BinSemCreate, recreate 2"); status = OS_BinSemCreate(&bin_3, "Bin 3", OS_SEM_EMPTY, 0); - /* UtDebug("Status after creating: %d,%d\n",status,bin_3); */ UtAssert_True(status == OS_SUCCESS, "OS_BinSemCreate, recreate 3"); status = OS_BinSemGetIdByName(&bin_0, "Bin 0"); - /* UtDebug("Status after GETID: %d,%d\n",status,bin_0); */ UtAssert_True(status == OS_SUCCESS, "OS_BinSemGetIdByName, Bin 0"); status = OS_BinSemGetIdByName(&bin_1, "Bin 1"); - /* UtDebug("Status after GETID: %d,%d\n",status,bin_1); */ UtAssert_True(status != OS_SUCCESS, "OS_BinSemGetIdByName, Bin 1"); status = OS_BinSemGetIdByName(&bin_2, "Bin 2"); - /* UtDebug("Status after GETID: %d,%d\n",status,bin_2); */ UtAssert_True(status == OS_SUCCESS, "OS_BinSemGetIdByName, Bin 2"); status = OS_BinSemGetIdByName(&bin_3, "Bin 3"); - /* UtDebug("Status after GETID: %d,%d\n",status,bin_3); */ UtAssert_True(status == OS_SUCCESS, "OS_BinSemGetIdByName, Bin 3"); /* @@ -442,12 +417,10 @@ void TestBinaries(void) UtAssert_True(status != OS_SUCCESS, "OS_BinSemDelete, Old ID"); status = OS_BinSemDelete(bin_0); - /* UtDebug("Status after deleteing:%d\n",status); */ UtAssert_True(status == OS_SUCCESS, "OS_BinSemDelete, Bin 0"); /* this one was never created */ status = OS_BinSemDelete(bin_1); - /* UtDebug("Status after deleteing:%d\n",status); */ UtAssert_True(status != OS_SUCCESS, "OS_BinSemDelete, Bin 1"); status = OS_BinSemDelete(bin_2); @@ -496,19 +469,15 @@ void TestMutexes(void) */ InitializeMutIds(); status = OS_MutSemCreate(&mut_0, "Mut 0", 0); - /* UtDebug("Status after creating Mut 0: %d,%d\n",status,mut_0); */ UtAssert_True(status == OS_SUCCESS, "OS_MutSemCreate, recreate 0"); status = OS_MutSemCreate(&mut_1, "Mut 0", 0); - /* UtDebug("Status after creating Mut 0 again: %d,%d\n",status,mut_1); */ UtAssert_True(status != OS_SUCCESS, "OS_MutSemCreate, dupe name 0"); status = OS_MutSemCreate(&mut_2, "Mut 2", 0); - /* UtDebug("Status after creating Mut 2: %d,%d\n",status,mut_2); */ UtAssert_True(status == OS_SUCCESS, "OS_MutSemCreate, recreate 2"); status = OS_MutSemCreate(&mut_3, "Mut 3", 0); - /* UtDebug("Status after creating Mut 3: %d,%d\n",status,mut_3); */ UtAssert_True(status == OS_SUCCESS, "OS_MutSemCreate, recreate 3"); status = OS_MutSemGetIdByName(&mut_0, "Mut 0"); @@ -530,20 +499,16 @@ void TestMutexes(void) UtAssert_True(status != OS_SUCCESS, "OS_MutSemDelete, Old ID"); status = OS_MutSemDelete(mut_0); - /* UtDebug("Status after deleteing Mut 0:%d\n",status); */ UtAssert_True(status == OS_SUCCESS, "OS_MutSemDelete, Mut 0"); /* this one was never created*/ status = OS_MutSemDelete(mut_1); - /* UtDebug("Status after deleteing Mut 1:%d\n",status); */ UtAssert_True(status != OS_SUCCESS, "OS_MutSemDelete, Mut 1"); status = OS_MutSemDelete(mut_2); - /* UtDebug("Status after deleteing Mut 2:%d\n",status); */ UtAssert_True(status == OS_SUCCESS, "OS_MutSemDelete, Mut 2"); status = OS_MutSemDelete(mut_3); - /* UtDebug("Status after deleteing Mut 3:%d\n",status); */ UtAssert_True(status == OS_SUCCESS, "OS_MutSemDelete, Mut 3"); } /* end TestMutexes */ @@ -556,40 +521,40 @@ void TestMutexes(void) /* ************************************************************************** */ void InitializeTaskIds(void) { - task_0_id = OS_OBJECT_ID_UNDEFINED; - task_1_id = OS_OBJECT_ID_UNDEFINED; - task_2_id = OS_OBJECT_ID_UNDEFINED; - task_3_id = OS_OBJECT_ID_UNDEFINED; + task_0_id = OS_OBJECT_ID_UNDEFINED; + task_1_id = OS_OBJECT_ID_UNDEFINED; + task_2_id = OS_OBJECT_ID_UNDEFINED; + task_3_id = OS_OBJECT_ID_UNDEFINED; return; } /* end InitializeTaskIds */ /* **************************************************************************** */ void InitializeQIds(void) { - msgq_0 = OS_OBJECT_ID_UNDEFINED; - msgq_1 = OS_OBJECT_ID_UNDEFINED; - msgq_2 = OS_OBJECT_ID_UNDEFINED; - msgq_3 = OS_OBJECT_ID_UNDEFINED; + msgq_0 = OS_OBJECT_ID_UNDEFINED; + msgq_1 = OS_OBJECT_ID_UNDEFINED; + msgq_2 = OS_OBJECT_ID_UNDEFINED; + msgq_3 = OS_OBJECT_ID_UNDEFINED; return; } /* end InitializeQIds */ /* ***************************************************************************** */ void InitializeBinIds(void) { - bin_0 = OS_OBJECT_ID_UNDEFINED; - bin_1 = OS_OBJECT_ID_UNDEFINED; - bin_2 = OS_OBJECT_ID_UNDEFINED; - bin_3 = OS_OBJECT_ID_UNDEFINED; + bin_0 = OS_OBJECT_ID_UNDEFINED; + bin_1 = OS_OBJECT_ID_UNDEFINED; + bin_2 = OS_OBJECT_ID_UNDEFINED; + bin_3 = OS_OBJECT_ID_UNDEFINED; return; } /* end InitializeBinIds */ /* ***************************************************************************** */ void InitializeMutIds(void) { - mut_0 = OS_OBJECT_ID_UNDEFINED; - mut_1 = OS_OBJECT_ID_UNDEFINED; - mut_2 = OS_OBJECT_ID_UNDEFINED; - mut_3 = OS_OBJECT_ID_UNDEFINED; + mut_0 = OS_OBJECT_ID_UNDEFINED; + mut_1 = OS_OBJECT_ID_UNDEFINED; + mut_2 = OS_OBJECT_ID_UNDEFINED; + mut_3 = OS_OBJECT_ID_UNDEFINED; return; } /* end InitializeMutIds */ @@ -604,20 +569,17 @@ void TestGetInfos(void) /* first step is to create an object to to get the properties of */ - status = OS_TaskCreate(&task_0_id, "Task 0", task_generic_no_exit, OSAL_STACKPTR_C(task_0_stack), sizeof(task_0_stack), - OSAL_PRIORITY_C(TASK_0_PRIORITY), 0); + status = OS_TaskCreate(&task_0_id, "Task 0", task_generic_no_exit, OSAL_STACKPTR_C(task_0_stack), + sizeof(task_0_stack), OSAL_PRIORITY_C(TASK_0_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "OS_TaskCreate"); status = OS_QueueCreate(&msgq_0, "q 0", OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); - /* UtDebug("Status after Creating q 0: %d,%d\n",status,msgq_0); */ UtAssert_True(status == OS_SUCCESS, "OS_QueueCreate"); status = OS_BinSemCreate(&bin_0, "Bin 0", 1, 0); - /* UtDebug("Status after creating: %d,%d\n",status,bin_0); */ UtAssert_True(status == OS_SUCCESS, "OS_BinSemCreate"); status = OS_MutSemCreate(&mut_0, "Mut 0", 0); - /* UtDebug("Status after creating: %d,%d\n",status,mut_0); */ UtAssert_True(status == OS_SUCCESS, "OS_MutSemCreate"); /* Next Step is to get the properties of the objects */ @@ -639,14 +601,11 @@ void TestGetInfos(void) status = OS_QueueDelete(msgq_0); UtAssert_True(status == OS_SUCCESS, "OS_QueueDelete"); - /* UtDebug("Status after Deleting q 0: %d\n",status); */ status = OS_BinSemDelete(bin_0); - /* UtDebug("Status after deleteing:%d\n",status); */ UtAssert_True(status == OS_SUCCESS, "OS_BinSemDelete"); status = OS_MutSemDelete(mut_0); - /* UtDebug("Status after deleteing:%d\n",status); */ UtAssert_True(status == OS_SUCCESS, "OS_MutSemDelete"); } @@ -660,8 +619,8 @@ void TestGenericQueries(void) TestCallbackState_t State; char ResourceName[OS_MAX_API_NAME]; - status = OS_TaskCreate(&task_0_id, "Task 0", task_generic_no_exit, OSAL_STACKPTR_C(task_0_stack), sizeof(task_0_stack), - OSAL_PRIORITY_C(TASK_0_PRIORITY), 0); + status = OS_TaskCreate(&task_0_id, "Task 0", task_generic_no_exit, OSAL_STACKPTR_C(task_0_stack), + sizeof(task_0_stack), OSAL_PRIORITY_C(TASK_0_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "OS_TaskCreate (%ld) == OS_SUCCESS", (long)status); status = OS_QueueCreate(&msgq_0, "q 0", OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); diff --git a/src/tests/queue-test/queue-test.c b/src/tests/queue-test/queue-test.c index a79caa265..352d8e2a3 100644 --- a/src/tests/queue-test/queue-test.c +++ b/src/tests/queue-test/queue-test.c @@ -35,7 +35,7 @@ void QueueTimeoutCheck(void); #define MSGQ_DEPTH 50 #define MSGQ_SIZE sizeof(uint32) #define MSGQ_TOTAL 10 -#define MSGQ_BURST 3 +#define MSGQ_BURST 3 /* Task 1 */ #define TASK_1_STACK_SIZE 1024 @@ -67,8 +67,8 @@ void task_1(void) { int32 status; size_t data_size; - uint32 data_received ; - uint32 expected = 0; + uint32 data_received; + uint32 expected = 0; OS_printf("Starting task 1\n"); @@ -87,7 +87,7 @@ void task_1(void) { ++task_1_messages; UtAssert_True(data_received == expected, "TASK 1: data_received (%u) == expected (%u)", - data_received, expected); + (unsigned int)data_received, (unsigned int)expected); expected++; } @@ -198,12 +198,12 @@ void QueueMessageSetup(void) { int32 status; uint32 accuracy; - int i; - uint32 Data = 0; + int i; + uint32 Data = 0; task_1_failures = 0; task_1_messages = 0; task_1_timeouts = 0; - + status = OS_QueueCreate(&msgq_id, "MsgQ", OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); UtAssert_True(status == OS_SUCCESS, "MsgQ create Id=%lx Rc=%d", OS_ObjectIdToInteger(msgq_id), (int)status); @@ -227,16 +227,16 @@ void QueueMessageSetup(void) status = OS_TimerSet(timer_id, timer_start, timer_interval); UtAssert_True(status == OS_SUCCESS, "Timer 1 set Rc=%d", (int)status); - /* - * Put 10 messages onto the que with some time inbetween the later messages - * to make sure the que handles both storing and waiting for messages - */ + /* + * Put 10 messages onto the que with some time inbetween the later messages + * to make sure the que handles both storing and waiting for messages + */ for (i = 0; i < MSGQ_TOTAL; i++) { - if(i > MSGQ_BURST) + if (i > MSGQ_BURST) OS_TaskDelay(400); - Data = i; + Data = i; status = OS_QueuePut(msgq_id, (void *)&Data, sizeof(Data), 0); UtAssert_True(status == OS_SUCCESS, "OS Queue Put Rc=%d", (int)status); } diff --git a/src/tests/select-test/select-test.c b/src/tests/select-test/select-test.c index a98db1e29..c9d773a55 100644 --- a/src/tests/select-test/select-test.c +++ b/src/tests/select-test/select-test.c @@ -257,17 +257,17 @@ void Setup_Multi(void) void Teardown_Single(void) { - OS_close(c_socket_id); - OS_BinSemDelete(bin_sem_id); + OS_close(c_socket_id); + OS_BinSemDelete(bin_sem_id); } void Teardown_Multi(void) -{ - //Server 1 is intentionaly left waiting so we close it out here. +{ + // Server 1 is intentionaly left waiting so we close it out here. OS_close(s_socket_id); OS_TaskDelete(s_task_id); - OS_close(c2_socket_id); + OS_close(c2_socket_id); Teardown_Single(); } @@ -286,8 +286,8 @@ void TestSelectSingleRead(void) */ /* Create a server task/thread */ - int32 status = OS_TaskCreate(&s_task_id, "ServerSingleRead", Server_Fn, OSAL_TASK_STACK_ALLOCATE, OSAL_SIZE_C(16384), - OSAL_PRIORITY_C(50), 0); + int32 status = OS_TaskCreate(&s_task_id, "ServerSingleRead", Server_Fn, OSAL_TASK_STACK_ALLOCATE, + OSAL_SIZE_C(16384), OSAL_PRIORITY_C(50), 0); UtAssert_True(status == OS_SUCCESS, "OS_TaskCreate() (%ld) == OS_SUCCESS", (long)status); /* Connect to a server */ @@ -385,8 +385,8 @@ void TestSelectSingleWrite(void) */ /* Create a server task/thread */ - int32 status = OS_TaskCreate(&s_task_id, "ServerSingleWrite", Server_Fn, OSAL_TASK_STACK_ALLOCATE, OSAL_SIZE_C(16384), - OSAL_PRIORITY_C(50), 0); + int32 status = OS_TaskCreate(&s_task_id, "ServerSingleWrite", Server_Fn, OSAL_TASK_STACK_ALLOCATE, + OSAL_SIZE_C(16384), OSAL_PRIORITY_C(50), 0); UtAssert_True(status == OS_SUCCESS, "OS_TaskCreate() (%ld) == OS_SUCCESS", (long)status); /* Connect to a server */ diff --git a/src/tests/timer-test/timer-test.c b/src/tests/timer-test/timer-test.c index 79ed1a43c..79ba39d5b 100644 --- a/src/tests/timer-test/timer-test.c +++ b/src/tests/timer-test/timer-test.c @@ -111,12 +111,12 @@ void TimerTestSetup(void) void TimerTestTask(void) { - int i = 0; - int32 TimerStatus[NUMBER_OF_TIMERS]; - osal_index_t TableId; - osal_id_t TimerID[NUMBER_OF_TIMERS]; - char TimerName[NUMBER_OF_TIMERS][20] = {"TIMER1", "TIMER2", "TIMER3", "TIMER4", "TIMER5"}; - uint32 ClockAccuracy; + int i = 0; + int32 TimerStatus[NUMBER_OF_TIMERS]; + osal_index_t TableId; + osal_id_t TimerID[NUMBER_OF_TIMERS]; + char TimerName[NUMBER_OF_TIMERS][20] = {"TIMER1", "TIMER2", "TIMER3", "TIMER4", "TIMER5"}; + uint32 ClockAccuracy; for (i = 0; i < NUMBER_OF_TIMERS && i < OS_MAX_TIMERS; i++) { diff --git a/src/unit-test-coverage/portable/adaptors/inc/ut-adaptor-portable-posix-files.h b/src/unit-test-coverage/portable/adaptors/inc/ut-adaptor-portable-posix-files.h index 82806e680..a405b68af 100644 --- a/src/unit-test-coverage/portable/adaptors/inc/ut-adaptor-portable-posix-files.h +++ b/src/unit-test-coverage/portable/adaptors/inc/ut-adaptor-portable-posix-files.h @@ -34,4 +34,4 @@ OCS_uid_t UT_PortablePosixFileTest_GetSelfEUID(void); OCS_gid_t UT_PortablePosixFileTest_GetSelfEGID(void); -#endif /* UT_ADAPTOR_PORTABLE_POSIX_FILES_H */ +#endif /* UT_ADAPTOR_PORTABLE_POSIX_FILES_H */ diff --git a/src/unit-test-coverage/portable/adaptors/inc/ut-adaptor-portable-posix-io.h b/src/unit-test-coverage/portable/adaptors/inc/ut-adaptor-portable-posix-io.h index 8385e3c2c..a4cadae82 100644 --- a/src/unit-test-coverage/portable/adaptors/inc/ut-adaptor-portable-posix-io.h +++ b/src/unit-test-coverage/portable/adaptors/inc/ut-adaptor-portable-posix-io.h @@ -40,4 +40,4 @@ *****************************************************/ void UT_PortablePosixIOTest_Set_Selectable(osal_index_t local_id, bool is_selectable); -#endif /* UT_ADAPTOR_PORTABLE_POSIX_IO_H */ +#endif /* UT_ADAPTOR_PORTABLE_POSIX_IO_H */ diff --git a/src/unit-test-coverage/portable/src/coveragetest-posix-dirs.c b/src/unit-test-coverage/portable/src/coveragetest-posix-dirs.c index 371e3b254..17d581fcd 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-posix-dirs.c +++ b/src/unit-test-coverage/portable/src/coveragetest-posix-dirs.c @@ -32,7 +32,9 @@ #include #include #include +#include #include +#include void Test_OS_DirCreate_Impl(void) { @@ -40,10 +42,22 @@ void Test_OS_DirCreate_Impl(void) * Test Case For: * int32 OS_DirCreate_Impl(const char *local_path, uint32 access) */ + struct OCS_stat statbuf; + OSAPI_TEST_FUNCTION_RC(OS_DirCreate_Impl, ("dir", 0), OS_SUCCESS); + /* With errno other than EEXIST it should return OS_ERROR */ + OCS_errno = OCS_EROFS; UT_SetDefaultReturnValue(UT_KEY(OCS_mkdir), -1); OSAPI_TEST_FUNCTION_RC(OS_DirCreate_Impl, ("dir", 0), OS_ERROR); + + /* If the errno is EEXIST it should return success */ + OCS_errno = OCS_EEXIST; + memset(&statbuf, 0, sizeof(statbuf)); + statbuf.st_mode = OCS_S_IFDIR; + UT_SetDataBuffer(UT_KEY(OCS_stat), &statbuf, sizeof(statbuf), false); + UT_SetDefaultReturnValue(UT_KEY(OCS_mkdir), -1); + OSAPI_TEST_FUNCTION_RC(OS_DirCreate_Impl, ("dir", 0), OS_SUCCESS); } void Test_OS_DirOpen_Impl(void) diff --git a/src/unit-test-coverage/portable/src/os-portable-coveragetest.h b/src/unit-test-coverage/portable/src/os-portable-coveragetest.h index 2d938fc4e..ce017dd0a 100644 --- a/src/unit-test-coverage/portable/src/os-portable-coveragetest.h +++ b/src/unit-test-coverage/portable/src/os-portable-coveragetest.h @@ -66,4 +66,4 @@ void Osapi_Test_Setup(void); void Osapi_Test_Teardown(void); -#endif /* OS_PORTABLE_COVERAGETEST_H */ +#endif /* OS_PORTABLE_COVERAGETEST_H */ diff --git a/src/unit-test-coverage/shared/adaptors/inc/ut-adaptor-module.h b/src/unit-test-coverage/shared/adaptors/inc/ut-adaptor-module.h index 0292ac666..da0ce088b 100644 --- a/src/unit-test-coverage/shared/adaptors/inc/ut-adaptor-module.h +++ b/src/unit-test-coverage/shared/adaptors/inc/ut-adaptor-module.h @@ -52,4 +52,4 @@ void Test_DummyFunc(void); int32 Osapi_Call_SymbolLookup_Static(cpuaddr *SymbolAddress, const char *SymbolName, const char *ModuleName); int32 Osapi_Call_ModuleLoad_Static(const char *ModuleName); -#endif /* UT_ADAPTOR_MODULE_H */ +#endif /* UT_ADAPTOR_MODULE_H */ diff --git a/src/unit-test-coverage/shared/src/coveragetest-clock.c b/src/unit-test-coverage/shared/src/coveragetest-clock.c index 8c7685c9f..244f8b2e1 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-clock.c +++ b/src/unit-test-coverage/shared/src/coveragetest-clock.c @@ -65,17 +65,17 @@ void Test_OS_TimeAccessConversions(void) { /* * Test cases for the various time access and conversion functions: - * + * * int64 OS_TimeGetTotalSeconds(OS_time_t tm) * int64 OS_TimeGetTotalMilliseconds(OS_time_t tm) * int64 OS_TimeGetTotalMicroseconds(OS_time_t tm) * int64 OS_TimeGetTotalNanoseconds(OS_time_t tm) - * + * * uint32 OS_TimeGetSubsecondsPart(OS_time_t tm) * uint32 OS_TimeGetMillisecondsPart(OS_time_t tm) * uint32 OS_TimeGetMicrosecondsPart(OS_time_t tm) * uint32 OS_TimeGetNanosecondsPart(OS_time_t tm) - * + * * OS_time_t OS_TimeAssembleFromMilliseconds(int64 seconds, uint32 milliseconds) * OS_time_t OS_TimeAssembleFromMicroseconds(int64 seconds, uint32 microseconds) * OS_time_t OS_TimeAssembleFromNanoseconds(int64 seconds, uint32 nanoseconds) @@ -90,23 +90,23 @@ void Test_OS_TimeAccessConversions(void) OS_time_t t4; /* To base-2 32-bit fixed point: 0.234567890 s * 0x100000000 ~= 0x3c0ca428 */ - t1 = OS_TimeAssembleFromNanoseconds(1,234567890); + t1 = OS_TimeAssembleFromNanoseconds(1, 234567890); /* From base-2 32-bit fixed point: 0x87654321 / 0x100000000 ~= 0.528888888 s */ - t2 = OS_TimeAssembleFromSubseconds(2,0x87654321); + t2 = OS_TimeAssembleFromSubseconds(2, 0x87654321); /* To base-2 32-bit fixed point: 0.045678 s * 0x100000000 ~= 0x0bb18dad */ - t3 = OS_TimeAssembleFromMicroseconds(0,45678); + t3 = OS_TimeAssembleFromMicroseconds(0, 45678); /* To base-2 32-bit fixed point: 0.901 s * 0x100000000 ~= 0xe6a7ef9e */ - t4 = OS_TimeAssembleFromMilliseconds(1,901); + t4 = OS_TimeAssembleFromMilliseconds(1, 901); /* These functions only return the total (whole + fraction) in the requested units */ UtAssert_UINT32_EQ(OS_TimeGetTotalSeconds(t1), 1); UtAssert_UINT32_EQ(OS_TimeGetTotalSeconds(t2), 2); UtAssert_UINT32_EQ(OS_TimeGetTotalSeconds(t3), 0); UtAssert_UINT32_EQ(OS_TimeGetTotalSeconds(t4), 1); - + UtAssert_UINT32_EQ(OS_TimeGetTotalMilliseconds(t1), 1234); UtAssert_UINT32_EQ(OS_TimeGetTotalMilliseconds(t2), 2528); UtAssert_UINT32_EQ(OS_TimeGetTotalMilliseconds(t3), 45); @@ -151,8 +151,8 @@ void Test_OS_TimeAccessConversions(void) UtAssert_UINT32_EQ(OS_TimeGetTotalMilliseconds(t4), 1234); /* Add/Subtract that will require carry */ - t1 = OS_TimeAssembleFromNanoseconds(3,777777777); - t2 = OS_TimeAssembleFromNanoseconds(4,888888888); + t1 = OS_TimeAssembleFromNanoseconds(3, 777777777); + t2 = OS_TimeAssembleFromNanoseconds(4, 888888888); t3 = OS_TimeAdd(t1, t2); UtAssert_UINT32_EQ(OS_TimeGetTotalMilliseconds(t3), 8666); @@ -160,8 +160,6 @@ void Test_OS_TimeAccessConversions(void) UtAssert_UINT32_EQ(OS_TimeGetTotalMilliseconds(t4), 3777); } - - /* Osapi_Test_Setup * * Purpose: diff --git a/src/unit-test-coverage/shared/src/coveragetest-common.c b/src/unit-test-coverage/shared/src/coveragetest-common.c index a8c3d8706..f760641bd 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-common.c +++ b/src/unit-test-coverage/shared/src/coveragetest-common.c @@ -57,9 +57,9 @@ static int32 TimeBaseInitGlobal(void *UserObj, int32 StubRetcode, uint32 CallCou static int32 ObjectDeleteCountHook(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) { - uint32 *counter = (uint32 *)Context->ArgPtr[1]; + uint32 *counter = UT_Hook_GetArgValueByName(Context, "callback_arg", uint32 *); - if (CallCount == 0) + if (CallCount < 2) { *counter = 1; } @@ -77,6 +77,11 @@ static int32 SetShutdownFlagHook(void *UserObj, int32 StubRetcode, uint32 CallCo return StubRetcode; } +static int32 TestEventHandlerHook(OS_Event_t event, osal_id_t object_id, void *data) +{ + return UT_DEFAULT_IMPL(TestEventHandlerHook); +} + /* ********************************************************************************** ** PUBLIC API FUNCTIONS @@ -258,6 +263,37 @@ void Test_OS_IdleLoopAndShutdown(void) UtAssert_True(CallCount == 1, "OS_ApplicationShutdown_Impl() call count (%lu) == 1", (unsigned long)CallCount); } +void Test_OS_NotifyEvent(void) +{ + /* + * Test cases for: + * int32 OS_NotifyEvent(OS_Event_t event, osal_id_t object_id, void *data) + * int32 OS_RegisterEventHandler(OS_EventHandler_t handler) + */ + + OS_SharedGlobalVars.EventHandler = NULL; + + /* With no hook function registered OS_NotifyEvent() should return success */ + OSAPI_TEST_FUNCTION_RC(OS_NotifyEvent(OS_EVENT_RESERVED, OS_OBJECT_ID_UNDEFINED, NULL), OS_SUCCESS); + + /* Registering a NULL hook function should fail */ + OSAPI_TEST_FUNCTION_RC(OS_RegisterEventHandler(NULL), OS_INVALID_POINTER); + + /* Now Register the locally-defined hook function */ + OSAPI_TEST_FUNCTION_RC(OS_RegisterEventHandler(TestEventHandlerHook), OS_SUCCESS); + + /* Now this should invoke the test hook */ + OSAPI_TEST_FUNCTION_RC(OS_NotifyEvent(OS_EVENT_RESERVED, OS_OBJECT_ID_UNDEFINED, NULL), OS_SUCCESS); + UtAssert_STUB_COUNT(TestEventHandlerHook, 1); + + /* Should also return whatever the hook returned */ + UT_SetDefaultReturnValue(UT_KEY(TestEventHandlerHook), -12345); + OSAPI_TEST_FUNCTION_RC(OS_NotifyEvent(OS_EVENT_RESERVED, OS_OBJECT_ID_UNDEFINED, NULL), -12345); + UtAssert_STUB_COUNT(TestEventHandlerHook, 2); + + OS_SharedGlobalVars.EventHandler = NULL; +} + /* ------------------- End of test cases --------------------------------------*/ /* Osapi_Test_Setup @@ -288,4 +324,5 @@ void UtTest_Setup(void) ADD_TEST(OS_CleanUpObject); ADD_TEST(OS_IdleLoopAndShutdown); ADD_TEST(OS_ApplicationExit); + ADD_TEST(OS_NotifyEvent); } diff --git a/src/unit-test-coverage/shared/src/coveragetest-file.c b/src/unit-test-coverage/shared/src/coveragetest-file.c index 401ff6ae2..3729b54b1 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-file.c +++ b/src/unit-test-coverage/shared/src/coveragetest-file.c @@ -386,6 +386,13 @@ void Test_OS_CloseAllFiles(void) actual = OS_CloseAllFiles(); UtAssert_True(actual == expected, "OS_CloseAllFiles() (%ld) == -222", (long)actual); + + /* This uses a helper function OS_FileIteratorClose() with the iterator, + * which needs to be called for coverage - it just invokes OS_close() */ + expected = OS_SUCCESS; + actual = OS_FileIteratorClose(UT_OBJID_1, NULL); + + UtAssert_True(actual == expected, "OS_FileIteratorClose() (%ld) == OS_SUCCESS", (long)actual); } /* Osapi_Test_Setup diff --git a/src/unit-test-coverage/shared/src/coveragetest-filesys.c b/src/unit-test-coverage/shared/src/coveragetest-filesys.c index 17e8dc1f5..ce24aabc7 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-filesys.c +++ b/src/unit-test-coverage/shared/src/coveragetest-filesys.c @@ -62,12 +62,11 @@ void Test_OS_FileSysAddFixedMap(void) OSAPI_TEST_FUNCTION_RC(OS_FileSysAddFixedMap(&id, "/phys", "/virt"), OS_FS_ERR_PATH_TOO_LONG); UT_SetDeferredRetcode(UT_KEY(OCS_memchr), 2, OS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_FileSysAddFixedMap(&id, "/phys", "/virt"), OS_FS_ERR_PATH_TOO_LONG); - UT_ResetState(UT_KEY(OCS_strlen)); UT_SetDefaultReturnValue(UT_KEY(OCS_strrchr), -1); - UT_SetDeferredRetcode(UT_KEY(OCS_strlen), 1, 2 + OS_FS_DEV_NAME_LEN); + UT_SetDeferredRetcode(UT_KEY(OCS_memchr), 3, OS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_FileSysAddFixedMap(&id, "/phys", "/virt"), OS_ERR_NAME_TOO_LONG); - UT_ResetState(UT_KEY(OCS_strlen)); + UT_ResetState(UT_KEY(OCS_memchr)); UT_ResetState(UT_KEY(OCS_strrchr)); OSAPI_TEST_FUNCTION_RC(OS_FileSysAddFixedMap(&id, "/phys", "/virt"), OS_SUCCESS); @@ -237,8 +236,8 @@ void Test_OS_unmount(void) UtAssert_True(actual == expected, "OS_mount() (%ld) == OS_ERR_NAME_NOT_FOUND", (long)actual); /* set up so record is in the right state for mounting */ - OS_filesys_table[1].flags = OS_FILESYS_FLAG_IS_READY | OS_FILESYS_FLAG_IS_MOUNTED_SYSTEM | - OS_FILESYS_FLAG_IS_MOUNTED_VIRTUAL; + OS_filesys_table[1].flags = + OS_FILESYS_FLAG_IS_READY | OS_FILESYS_FLAG_IS_MOUNTED_SYSTEM | OS_FILESYS_FLAG_IS_MOUNTED_VIRTUAL; expected = OS_SUCCESS; actual = OS_unmount("/ram0"); UtAssert_True(actual == expected, "OS_unmount(nominal) (%ld) == OS_SUCCESS", (long)actual); @@ -269,19 +268,19 @@ void Test_OS_FileSysStatVolume(void) statref.blocks_free = OSAL_BLOCKCOUNT_C(1111); statref.total_blocks = OSAL_BLOCKCOUNT_C(2222); UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume_Impl), &statref, sizeof(statref), false); - OS_filesys_table[1].flags = OS_FILESYS_FLAG_IS_READY | OS_FILESYS_FLAG_IS_MOUNTED_SYSTEM | - OS_FILESYS_FLAG_IS_MOUNTED_VIRTUAL; + OS_filesys_table[1].flags = + OS_FILESYS_FLAG_IS_READY | OS_FILESYS_FLAG_IS_MOUNTED_SYSTEM | OS_FILESYS_FLAG_IS_MOUNTED_VIRTUAL; expected = OS_SUCCESS; actual = OS_FileSysStatVolume("/cf", &statbuf); UtAssert_True(actual == expected, "OS_FileSysStatVolume() (%ld) == OS_SUCCESS", (long)actual); - UtAssert_True(statbuf.block_size == statref.block_size, "blocks_size (%lu) == %lu", (unsigned long)statbuf.block_size, - (unsigned long)statref.block_size); + UtAssert_True(statbuf.block_size == statref.block_size, "blocks_size (%lu) == %lu", + (unsigned long)statbuf.block_size, (unsigned long)statref.block_size); UtAssert_True(statbuf.total_blocks == statref.total_blocks, "total_blocks (%lu) == %lu", (unsigned long)statbuf.total_blocks, (unsigned long)statref.total_blocks); - UtAssert_True(statbuf.blocks_free == statref.blocks_free, "blocks_free (%lu) == %lu", (unsigned long)statbuf.blocks_free, - (unsigned long)statref.blocks_free); + UtAssert_True(statbuf.blocks_free == statref.blocks_free, "blocks_free (%lu) == %lu", + (unsigned long)statbuf.blocks_free, (unsigned long)statref.blocks_free); /* validate error checking */ expected = OS_INVALID_POINTER; @@ -357,8 +356,8 @@ void Test_OS_FS_GetPhysDriveName(void) actual = OS_FS_GetPhysDriveName(NameBuf, "none"); UtAssert_True(actual == expected, "OS_FS_GetPhysDriveName() (%ld) == OS_ERR_INCORRECT_OBJ_STATE", (long)actual); - OS_filesys_table[1].flags = OS_FILESYS_FLAG_IS_READY | OS_FILESYS_FLAG_IS_MOUNTED_SYSTEM | - OS_FILESYS_FLAG_IS_MOUNTED_VIRTUAL; + OS_filesys_table[1].flags = + OS_FILESYS_FLAG_IS_READY | OS_FILESYS_FLAG_IS_MOUNTED_SYSTEM | OS_FILESYS_FLAG_IS_MOUNTED_VIRTUAL; expected = OS_SUCCESS; actual = OS_FS_GetPhysDriveName(NameBuf, "none"); UtAssert_True(actual == expected, "OS_FS_GetPhysDriveName() (%ld) == OS_SUCCESS", (long)actual); @@ -376,9 +375,10 @@ void Test_OS_GetFsInfo(void) * Test Case For: * int32 OS_GetFsInfo(OS_FsInfo_t *filesys_info) */ - int32 expected = OS_SUCCESS; - int32 actual = ~OS_SUCCESS; - os_fsinfo_t filesys_info; + int32 expected = OS_SUCCESS; + int32 actual = ~OS_SUCCESS; + os_fsinfo_t filesys_info; + OS_common_record_t rec; UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdIteratorGetNext), 1); UT_SetDeferredRetcode(UT_KEY(OS_ObjectIdIteratorGetNext), 3, 0); @@ -394,15 +394,21 @@ void Test_OS_GetFsInfo(void) "filesys_info.MaxVolumes (%lu) == OS_MAX_FILE_SYSTEMS", (unsigned long)filesys_info.MaxVolumes); /* since there are no open files, the free fd count should match the max */ - UtAssert_True(filesys_info.FreeFds == 2, "filesys_info.FreeFds (%lu) == 2", - (unsigned long)filesys_info.FreeFds); + UtAssert_True(filesys_info.FreeFds == 2, "filesys_info.FreeFds (%lu) == 2", (unsigned long)filesys_info.FreeFds); UtAssert_True(filesys_info.FreeVolumes == 3, "filesys_info.FreeVolumes (%lu) == 3", - (unsigned long)filesys_info.FreeVolumes); + (unsigned long)filesys_info.FreeVolumes); expected = OS_INVALID_POINTER; actual = OS_GetFsInfo(NULL); UtAssert_True(actual == expected, "OS_GetFsInfo() (%ld) == OS_INVALID_POINTER", (long)actual); + + /* This function uses a helper OS_FileSysFilterFree() that needs to be called for coverage. */ + /* It is just a wrapper around OS_ObjectIdDefined() for the record ID */ + memset(&rec, 0, sizeof(rec)); + UtAssert_True(OS_FileSysFilterFree(NULL, NULL, &rec), "OS_FileSysFilterFree() (unused record)"); + rec.active_id = UT_OBJID_1; + UtAssert_True(!OS_FileSysFilterFree(NULL, NULL, &rec), "!OS_FileSysFilterFree() (used record)"); } void Test_OS_TranslatePath(void) @@ -416,8 +422,8 @@ void Test_OS_TranslatePath(void) int32 actual = ~OS_SUCCESS; /* Set up the local record for success */ - OS_filesys_table[1].flags = OS_FILESYS_FLAG_IS_READY | OS_FILESYS_FLAG_IS_MOUNTED_SYSTEM | - OS_FILESYS_FLAG_IS_MOUNTED_VIRTUAL; + OS_filesys_table[1].flags = + OS_FILESYS_FLAG_IS_READY | OS_FILESYS_FLAG_IS_MOUNTED_SYSTEM | OS_FILESYS_FLAG_IS_MOUNTED_VIRTUAL; strcpy(OS_filesys_table[1].virtual_mountpt, "/cf"); strcpy(OS_filesys_table[1].system_mountpt, "/mnt/cf"); @@ -431,18 +437,18 @@ void Test_OS_TranslatePath(void) actual = OS_TranslatePath(NULL, NULL); UtAssert_True(actual == expected, "OS_TranslatePath(NULL,NULL) (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), OS_MAX_PATH_LEN + 10); + UT_SetDefaultReturnValue(UT_KEY(OCS_memchr), OS_ERROR); expected = OS_FS_ERR_PATH_TOO_LONG; actual = OS_TranslatePath("/cf/test", LocalBuffer); UtAssert_True(actual == expected, "OS_TranslatePath() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); - UT_ClearDefaultReturnValue(UT_KEY(OCS_strlen)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_memchr)); /* Invalid no '/' */ expected = OS_FS_ERR_PATH_INVALID; actual = OS_TranslatePath("invalid", LocalBuffer); UtAssert_True(actual == expected, "OS_TranslatePath() (%ld) == OS_FS_ERR_PATH_INVALID", (long)actual); - UT_SetDeferredRetcode(UT_KEY(OCS_strlen), 2, OS_MAX_FILE_NAME + 1); + UT_SetDeferredRetcode(UT_KEY(OCS_memchr), 2, OS_ERROR); expected = OS_FS_ERR_NAME_TOO_LONG; actual = OS_TranslatePath("/cf/test", LocalBuffer); UtAssert_True(actual == expected, "OS_TranslatePath(/cf/test) (%ld) == OS_FS_ERR_NAME_TOO_LONG", (long)actual); @@ -458,13 +464,13 @@ void Test_OS_TranslatePath(void) UT_ClearDefaultReturnValue(UT_KEY(OS_ObjectIdGetBySearch)); /* VirtPathLen < VirtPathBegin */ - UT_SetDeferredRetcode(UT_KEY(OCS_strlen), 4, OS_MAX_PATH_LEN); + UT_SetDeferredRetcode(UT_KEY(OCS_memchr), 4, OS_ERROR); expected = OS_FS_ERR_PATH_INVALID; actual = OS_TranslatePath("/cf/test", LocalBuffer); UtAssert_True(actual == expected, "OS_TranslatePath(/cf/test) (%ld) == OS_FS_ERR_PATH_INVALID", (long)actual); /* (SysMountPointLen + VirtPathLen) > OS_MAX_LOCAL_PATH_LEN */ - UT_SetDeferredRetcode(UT_KEY(OCS_strlen), 3, OS_MAX_LOCAL_PATH_LEN); + UT_SetDeferredRetcode(UT_KEY(OCS_memchr), 3, OS_ERROR); expected = OS_FS_ERR_PATH_TOO_LONG; actual = OS_TranslatePath("/cf/test", LocalBuffer); UtAssert_True(actual == expected, "OS_TranslatePath(/cf/test) (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); diff --git a/src/unit-test-coverage/shared/src/coveragetest-idmap.c b/src/unit-test-coverage/shared/src/coveragetest-idmap.c index a4c28141a..00834d784 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-idmap.c +++ b/src/unit-test-coverage/shared/src/coveragetest-idmap.c @@ -96,7 +96,7 @@ void Test_OS_LockUnlockGlobal(void) memset(&token, 0, sizeof(token)); - token.obj_type = OS_OBJECT_TYPE_OS_COUNTSEM; + token.obj_type = OS_OBJECT_TYPE_OS_COUNTSEM; token.lock_mode = OS_LOCK_MODE_GLOBAL; /* @@ -236,8 +236,8 @@ void Test_OS_ObjectIdConvertToken(void) token.obj_id = objid; actual = OS_ObjectIdConvertToken(&token); expected = OS_ERR_INVALID_ID; - UtAssert_True(actual == expected, "OS_ObjectIdConvertLock(RESERVED) (%ld) == OS_ERR_INVALID_ID (%ld)", - (long)actual, (long)expected); + UtAssert_True(actual == expected, "OS_ObjectIdConvertLock(RESERVED) (%ld) == OS_ERR_INVALID_ID (%ld)", (long)actual, + (long)expected); /* Global should not be released */ UtAssert_STUB_COUNT(OS_Unlock_Global_Impl, 2); @@ -284,8 +284,8 @@ void Test_OS_ObjectIdConvertToken(void) token.obj_id = objid; actual = OS_ObjectIdConvertToken(&token); expected = OS_SUCCESS; - UtAssert_True(actual == expected, "OS_ObjectIdConvertLock(RESERVED) (%ld) == OS_SUCCESS (%ld)", - (long)actual, (long)expected); + UtAssert_True(actual == expected, "OS_ObjectIdConvertLock(RESERVED) (%ld) == OS_SUCCESS (%ld)", (long)actual, + (long)expected); /* Global should not be released */ UtAssert_STUB_COUNT(OS_Unlock_Global_Impl, 3); @@ -429,8 +429,7 @@ void Test_OS_ObjectIdFindByName(void) char TaskName[] = "UT_find"; osal_id_t objid; int32 expected = OS_ERR_NAME_NOT_FOUND; - int32 actual = OS_ObjectIdFindByName(OS_OBJECT_TYPE_UNDEFINED, NULL, NULL); - + int32 actual = OS_ObjectIdFindByName(OS_OBJECT_TYPE_UNDEFINED, NULL, &objid); UtAssert_True(actual == expected, "OS_ObjectFindIdByName(%s) (%ld) == OS_ERR_NAME_NOT_FOUND", "NULL", (long)actual); /* @@ -721,9 +720,8 @@ void Test_OS_ObjectIdAllocateNew(void) */ UT_SetDefaultReturnValue(UT_KEY(OS_NotifyEvent), OS_ERR_INVALID_SIZE); expected = OS_ERR_INVALID_SIZE; - actual = OS_ObjectIdAllocateNew(OS_OBJECT_TYPE_OS_TASK, "UT_alloc2", &token); + actual = OS_ObjectIdAllocateNew(OS_OBJECT_TYPE_OS_TASK, "UT_alloc2", &token); UtAssert_True(actual == expected, "OS_ObjectIdAllocateNew() (%ld) == OS_ERR_INVALID_SIZE", (long)actual); - } void Test_OS_ConvertToArrayIndex(void) @@ -735,7 +733,7 @@ void Test_OS_ConvertToArrayIndex(void) * */ int32 expected = OS_SUCCESS; - int32 actual = ~OS_SUCCESS; // OS_ConvertToArrayIndex(); + int32 actual; osal_id_t refobjid; osal_index_t local_idx; @@ -775,15 +773,17 @@ void Test_OS_ObjectIdTransaction(void) UtAssert_STUB_COUNT(OS_Lock_Global_Impl, 0); /* shutdown will prevent transactions */ - OS_SharedGlobalVars.Initialized = true; + OS_SharedGlobalVars.Initialized = true; OS_SharedGlobalVars.ShutdownFlag = OS_SHUTDOWN_MAGIC_NUMBER; - OSAPI_TEST_FUNCTION_RC(OS_ObjectIdTransactionInit(OS_LOCK_MODE_GLOBAL, OS_OBJECT_TYPE_OS_BINSEM, &token), OS_ERR_INCORRECT_OBJ_STATE); + OSAPI_TEST_FUNCTION_RC(OS_ObjectIdTransactionInit(OS_LOCK_MODE_GLOBAL, OS_OBJECT_TYPE_OS_BINSEM, &token), + OS_ERR_INCORRECT_OBJ_STATE); UtAssert_UINT32_EQ(token.lock_mode, OS_LOCK_MODE_NONE); UtAssert_UINT32_EQ(token.obj_type, OS_OBJECT_TYPE_UNDEFINED); UtAssert_STUB_COUNT(OS_Lock_Global_Impl, 0); /* except for exclusive (delete) transactions, which should succeed */ - OSAPI_TEST_FUNCTION_RC(OS_ObjectIdTransactionInit(OS_LOCK_MODE_EXCLUSIVE, OS_OBJECT_TYPE_OS_BINSEM, &token), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_ObjectIdTransactionInit(OS_LOCK_MODE_EXCLUSIVE, OS_OBJECT_TYPE_OS_BINSEM, &token), + OS_SUCCESS); UtAssert_UINT32_EQ(token.lock_mode, OS_LOCK_MODE_EXCLUSIVE); UtAssert_UINT32_EQ(token.obj_idx, -1); UtAssert_STUB_COUNT(OS_Lock_Global_Impl, 1); @@ -794,24 +794,26 @@ void Test_OS_ObjectIdTransaction(void) /* other cases for normal operating mode */ OS_SharedGlobalVars.ShutdownFlag = 0; - OSAPI_TEST_FUNCTION_RC(OS_ObjectIdTransactionInit(OS_LOCK_MODE_GLOBAL, OS_OBJECT_TYPE_OS_COUNTSEM, &token), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_ObjectIdTransactionInit(OS_LOCK_MODE_GLOBAL, OS_OBJECT_TYPE_OS_COUNTSEM, &token), + OS_SUCCESS); UtAssert_UINT32_EQ(token.lock_mode, OS_LOCK_MODE_GLOBAL); UtAssert_UINT32_EQ(token.obj_type, OS_OBJECT_TYPE_OS_COUNTSEM); UtAssert_STUB_COUNT(OS_Lock_Global_Impl, 2); /* bad object type */ - OSAPI_TEST_FUNCTION_RC(OS_ObjectIdTransactionInit(OS_LOCK_MODE_GLOBAL, OS_OBJECT_TYPE_UNDEFINED, &token), OS_ERR_INCORRECT_OBJ_TYPE); + OSAPI_TEST_FUNCTION_RC(OS_ObjectIdTransactionInit(OS_LOCK_MODE_GLOBAL, OS_OBJECT_TYPE_UNDEFINED, &token), + OS_ERR_INCORRECT_OBJ_TYPE); UtAssert_UINT32_EQ(token.lock_mode, OS_LOCK_MODE_NONE); UtAssert_UINT32_EQ(token.obj_type, OS_OBJECT_TYPE_UNDEFINED); UtAssert_STUB_COUNT(OS_Lock_Global_Impl, 2); /* normal finish (sets ID from passed in value) */ - objid = UT_OBJID_1; - token.obj_id = UT_OBJID_2; - token.obj_idx = UT_INDEX_2; - token.obj_type = OS_OBJECT_TYPE_OS_TASK; - token.lock_mode = OS_LOCK_MODE_GLOBAL; - record = OS_ObjectIdGlobalFromToken(&token); + objid = UT_OBJID_1; + token.obj_id = UT_OBJID_2; + token.obj_idx = UT_INDEX_2; + token.obj_type = OS_OBJECT_TYPE_OS_TASK; + token.lock_mode = OS_LOCK_MODE_GLOBAL; + record = OS_ObjectIdGlobalFromToken(&token); record->refcount = 1; OS_ObjectIdTransactionFinish(&token, &objid); @@ -821,9 +823,9 @@ void Test_OS_ObjectIdTransaction(void) UtAssert_UINT32_EQ(record->refcount, 0); /* exclusive lock finish (restores ID from token) */ - record->refcount = 1; + record->refcount = 1; record->active_id = OS_OBJECT_ID_RESERVED; - token.lock_mode = OS_LOCK_MODE_EXCLUSIVE; + token.lock_mode = OS_LOCK_MODE_EXCLUSIVE; OS_ObjectIdTransactionFinish(&token, NULL); UtAssert_STUB_COUNT(OS_Lock_Global_Impl, 3); UtAssert_STUB_COUNT(OS_Unlock_Global_Impl, 3); @@ -831,8 +833,8 @@ void Test_OS_ObjectIdTransaction(void) UtAssert_UINT32_EQ(record->refcount, 0); /* refcount finish (no change to ID) */ - token.lock_mode = OS_LOCK_MODE_REFCOUNT; - record->refcount = 1; + token.lock_mode = OS_LOCK_MODE_REFCOUNT; + record->refcount = 1; record->active_id = UT_OBJID_1; OS_ObjectIdTransactionFinish(&token, NULL); UtAssert_STUB_COUNT(OS_Lock_Global_Impl, 4); @@ -850,9 +852,9 @@ void Test_OS_ObjectIdTransaction(void) /* test transferring a refcount token */ memset(&token2, 0xBB, sizeof(token2)); - token.obj_id = UT_OBJID_2; - token.obj_idx = UT_INDEX_2; - token.obj_type = OS_OBJECT_TYPE_OS_TASK; + token.obj_id = UT_OBJID_2; + token.obj_idx = UT_INDEX_2; + token.obj_type = OS_OBJECT_TYPE_OS_TASK; token.lock_mode = OS_LOCK_MODE_GLOBAL; OS_ObjectIdTransferToken(&token, &token2); @@ -874,66 +876,71 @@ void Test_OS_ObjectIdFinalize(void) * int32 OS_ObjectIdFinalizeNew(int32 operation_status, OS_object_token_t *token, osal_id_t *outid); * int32 OS_ObjectIdFinalizeDelete(int32 operation_status, OS_object_token_t *token); */ - int32 expected; - int32 actual; - OS_object_token_t token; - osal_id_t objid; + int32 expected; + int32 actual; + OS_object_token_t token; + osal_id_t objid; OS_common_record_t *record; memset(&token, 0, sizeof(token)); - objid = UT_OBJID_1; - token.obj_id = UT_OBJID_2; - token.obj_idx = UT_INDEX_2; - token.obj_type = OS_OBJECT_TYPE_OS_TASK; + objid = UT_OBJID_1; + token.obj_id = UT_OBJID_2; + token.obj_idx = UT_INDEX_2; + token.obj_type = OS_OBJECT_TYPE_OS_TASK; token.lock_mode = OS_LOCK_MODE_EXCLUSIVE; record = OS_ObjectIdGlobalFromToken(&token); /* if creation fails, RC should be passed through and ID set to UNDEFINED */ - token.lock_mode = OS_LOCK_MODE_EXCLUSIVE; + token.lock_mode = OS_LOCK_MODE_EXCLUSIVE; record->active_id = OS_OBJECT_ID_RESERVED; - expected = OS_ERR_INVALID_ID; - actual = OS_ObjectIdFinalizeNew(OS_ERR_INVALID_ID, &token, &objid); - UtAssert_True(actual == expected, "OS_ObjectIdFinalizeNew() rc passthru (%ld) == OS_ERR_INVALID_ID (%ld)", (long)actual, (long)expected); + expected = OS_ERR_INVALID_ID; + actual = OS_ObjectIdFinalizeNew(OS_ERR_INVALID_ID, &token, &objid); + UtAssert_True(actual == expected, "OS_ObjectIdFinalizeNew() rc passthru (%ld) == OS_ERR_INVALID_ID (%ld)", + (long)actual, (long)expected); OSAPI_TEST_OBJID(objid, ==, OS_OBJECT_ID_UNDEFINED); OSAPI_TEST_OBJID(record->active_id, ==, OS_OBJECT_ID_UNDEFINED); UtAssert_UINT32_EQ(token.lock_mode, OS_LOCK_MODE_NONE); /* if creation succeeds, RC should be passed through and ID set to token value */ - token.lock_mode = OS_LOCK_MODE_EXCLUSIVE; + token.lock_mode = OS_LOCK_MODE_EXCLUSIVE; record->active_id = OS_OBJECT_ID_RESERVED; - expected = OS_SUCCESS; - actual = OS_ObjectIdFinalizeNew(OS_SUCCESS, &token, &objid); - UtAssert_True(actual == expected, "OS_ObjectIdFinalizeNew() rc passthru (%ld) == OS_SUCCESS (%ld)", (long)actual, (long)expected); + expected = OS_SUCCESS; + actual = OS_ObjectIdFinalizeNew(OS_SUCCESS, &token, &objid); + UtAssert_True(actual == expected, "OS_ObjectIdFinalizeNew() rc passthru (%ld) == OS_SUCCESS (%ld)", (long)actual, + (long)expected); OSAPI_TEST_OBJID(objid, ==, token.obj_id); OSAPI_TEST_OBJID(record->active_id, ==, token.obj_id); UtAssert_UINT32_EQ(token.lock_mode, OS_LOCK_MODE_NONE); /* verify passing NULL for out ID for path coverage */ - token.lock_mode = OS_LOCK_MODE_EXCLUSIVE; + token.lock_mode = OS_LOCK_MODE_EXCLUSIVE; record->active_id = OS_OBJECT_ID_RESERVED; - expected = OS_SUCCESS; - actual = OS_ObjectIdFinalizeNew(OS_SUCCESS, &token, NULL); - UtAssert_True(actual == expected, "OS_ObjectIdFinalizeNew() rc passthru (%ld) == OS_SUCCESS (%ld)", (long)actual, (long)expected); + expected = OS_SUCCESS; + actual = OS_ObjectIdFinalizeNew(OS_SUCCESS, &token, NULL); + UtAssert_True(actual == expected, "OS_ObjectIdFinalizeNew() rc passthru (%ld) == OS_SUCCESS (%ld)", (long)actual, + (long)expected); OSAPI_TEST_OBJID(record->active_id, ==, token.obj_id); UtAssert_UINT32_EQ(token.lock_mode, OS_LOCK_MODE_NONE); /* if delete succeeds, RC should be passed through and ID set to UNDEFINED */ - token.lock_mode = OS_LOCK_MODE_EXCLUSIVE; + token.lock_mode = OS_LOCK_MODE_EXCLUSIVE; record->active_id = OS_OBJECT_ID_RESERVED; - expected = OS_SUCCESS; - actual = OS_ObjectIdFinalizeDelete(OS_SUCCESS, &token); - UtAssert_True(actual == expected, "OS_ObjectIdFinalizeDelete() rc passthru (%ld) == OS_SUCCESS (%ld)", (long)actual, (long)expected); + expected = OS_SUCCESS; + actual = OS_ObjectIdFinalizeDelete(OS_SUCCESS, &token); + UtAssert_True(actual == expected, "OS_ObjectIdFinalizeDelete() rc passthru (%ld) == OS_SUCCESS (%ld)", (long)actual, + (long)expected); OSAPI_TEST_OBJID(record->active_id, ==, OS_OBJECT_ID_UNDEFINED); UtAssert_UINT32_EQ(token.lock_mode, OS_LOCK_MODE_NONE); /* if delete fails, RC should be passed through and ID set to the token value */ - token.lock_mode = OS_LOCK_MODE_EXCLUSIVE; + token.lock_mode = OS_LOCK_MODE_EXCLUSIVE; record->active_id = OS_OBJECT_ID_RESERVED; - expected = OS_ERR_INVALID_ID; - actual = OS_ObjectIdFinalizeDelete(OS_ERR_INVALID_ID, &token); - UtAssert_True(actual == expected, "OS_ObjectIdFinalizeDelete() rc passthru (%ld) == OS_ERR_INVALID_ID (%ld)", (long)actual, (long)expected); + expected = OS_ERR_INVALID_ID; + actual = OS_ObjectIdFinalizeDelete(OS_ERR_INVALID_ID, &token); + UtAssert_True(actual == expected, "OS_ObjectIdFinalizeDelete() rc passthru (%ld) == OS_ERR_INVALID_ID (%ld)", + (long)actual, (long)expected); OSAPI_TEST_OBJID(record->active_id, ==, token.obj_id); UtAssert_UINT32_EQ(token.lock_mode, OS_LOCK_MODE_NONE); } @@ -1029,19 +1036,15 @@ void Test_OS_ObjectIdIterator(void) { /* * Test Case For: - * int32 OS_ObjectIdIteratorInit(OS_ObjectMatchFunc_t matchfunc, void *matcharg, osal_objtype_t objtype, - OS_object_iter_t *iter); - * bool OS_ObjectFilterActive(void *ref, const OS_object_token_t *token, const OS_common_record_t *obj); - * int32 OS_ObjectIdIterateActive(osal_objtype_t objtype, OS_object_iter_t *iter); - * bool OS_ObjectIdIteratorGetNext(OS_object_iter_t *iter); - * void OS_ObjectIdIteratorDestroy(OS_object_iter_t *iter); - * int32 OS_ObjectIdIteratorProcessEntry(OS_object_iter_t *iter, int32 (*func)(osal_id_t, void *)); + * OS_ObjectIdIteratorInit, OS_ObjectFilterActive, OS_ObjectIdIterateActive + * OS_ObjectIdIteratorGetNext, OS_ObjectIdIteratorDestroy, OS_ObjectIdIteratorProcessEntry */ - OS_object_iter_t iter; + OS_object_iter_t iter; OS_common_record_t rec; - uint32 testarg; + uint32 testarg; - OSAPI_TEST_FUNCTION_RC(OS_ObjectIdIteratorInit(NULL, NULL, OS_OBJECT_TYPE_UNDEFINED, &iter), OS_ERR_INCORRECT_OBJ_TYPE); + OSAPI_TEST_FUNCTION_RC(OS_ObjectIdIteratorInit(NULL, NULL, OS_OBJECT_TYPE_UNDEFINED, &iter), + OS_ERR_INCORRECT_OBJ_TYPE); OSAPI_TEST_FUNCTION_RC(OS_ObjectIdIterateActive(OS_OBJECT_TYPE_OS_TASK, &iter), OS_SUCCESS); UtAssert_STUB_COUNT(OS_Lock_Global_Impl, 1); @@ -1052,18 +1055,16 @@ void Test_OS_ObjectIdIterator(void) UtAssert_True(OS_ObjectFilterActive(NULL, NULL, &rec), "OS_ObjectFilterActive() non-empty record"); /* OS_ObjectIdIteratorProcessEntry unlocks and re-locks */ - testarg = 4; + testarg = 4; iter.arg = &testarg; OS_ObjectIdIteratorProcessEntry(&iter, TestIterator); UtAssert_STUB_COUNT(OS_Unlock_Global_Impl, 1); UtAssert_STUB_COUNT(OS_Lock_Global_Impl, 2); - /* OS_ObjectIdIteratorDestroy is just a passthrough to OS_ObjectIdTransactionCancel, * but need to call for coverage */ OS_ObjectIdIteratorDestroy(&iter); UtAssert_STUB_COUNT(OS_Unlock_Global_Impl, 2); - } /* Osapi_Test_Setup diff --git a/src/unit-test-coverage/shared/src/coveragetest-module.c b/src/unit-test-coverage/shared/src/coveragetest-module.c index 043ebeb36..2552626bb 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-module.c +++ b/src/unit-test-coverage/shared/src/coveragetest-module.c @@ -158,6 +158,44 @@ void Test_OS_SymbolLookup(void) UtAssert_True(actual == expected, "OS_SymbolLookup(UT_staticsym) (%ld) == OS_SUCCESS", (long)actual); } +void Test_OS_ModuleSymbolLookup(void) +{ + /* + * Test Case For: + * int32 OS_ModuleSymbolLookup(osal_id_t module_id, cpuaddr *symbol_address, const char *symbol_name) + */ + int32 expected = OS_SUCCESS; + int32 actual = ~OS_SUCCESS; + cpuaddr testaddr = 0; + cpuaddr symaddr = 0; + + actual = OS_ModuleSymbolLookup(OS_OBJECT_ID_UNDEFINED, &symaddr, "uttestsym0"); + UtAssert_True(actual == expected, "OS_ModuleSymbolLookup(name=%s) (%ld) == OS_SUCCESS", "uttestsym0", (long)actual); + + UT_ResetState(UT_KEY(OS_ModuleSymbolLookup_Impl)); + UT_SetDefaultReturnValue(UT_KEY(OS_ModuleSymbolLookup_Impl), OS_ERROR); + + /* this lookup should always fail */ + symaddr = 0; + testaddr = 0; + actual = OS_ModuleSymbolLookup(OS_OBJECT_ID_UNDEFINED, &symaddr, "uttestsym1"); + expected = OS_ERROR; + UtAssert_True(actual == expected, "OS_ModuleSymbolLookup(name=%s) (%ld) == OS_ERROR", "uttestsym1", (long)actual); + UtAssert_True(symaddr == testaddr, "OS_ModuleSymbolLookup(address=%lx) == %lx", (unsigned long)symaddr, + (unsigned long)testaddr); + + actual = OS_ModuleSymbolLookup(OS_OBJECT_ID_UNDEFINED, NULL, NULL); + expected = OS_INVALID_POINTER; + UtAssert_True(actual == expected, "OS_ModuleSymbolLookup(NULL) (%ld) == OS_INVALID_POINTER", (long)actual); + + /* + * Look up a symbol that is present in the static symbol table + */ + actual = OS_ModuleSymbolLookup(OS_OBJECT_ID_UNDEFINED, &symaddr, "UT_staticsym"); + expected = OS_SUCCESS; + UtAssert_True(actual == expected, "OS_ModuleSymbolLookup(UT_staticsym) (%ld) == OS_SUCCESS", (long)actual); +} + void Test_OS_StaticSymbolLookup(void) { /* @@ -190,7 +228,7 @@ void Test_OS_StaticSymbolLookup(void) UtAssert_True(actual == expected, "OS_ModuleLoad_Static(name=%s) (%ld) == OS_SUCCESS", "UT", (long)actual); expected = OS_ERROR; - actual = OS_SymbolLookup_Static(&addr, "UT_staticsym", "NoModuleMatch"); + actual = OS_SymbolLookup_Static(&addr, "UT_staticsym", "NoModuleMatch"); UtAssert_True(actual == expected, "OS_SymbolLookup_Static(name=%s, NoModuleMatch) (%ld) == OS_ERROR", "Test_Func1", (long)actual); UtAssert_True(addr == (cpuaddr)&Test_DummyFunc, "OS_SymbolLookup_Static(address=%lx) == %lx", (unsigned long)addr, @@ -221,6 +259,12 @@ void Test_OS_SymbolTableDump(void) expected = OS_ERROR; actual = OS_SymbolTableDump("test", OSAL_SIZE_C(555)); UtAssert_True(actual == expected, "OS_SymbolTableDump() (%ld) == OS_ERROR", (long)actual); + + UT_ResetState(UT_KEY(OS_TranslatePath)); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdTransactionInit), OS_ERROR); + expected = OS_ERROR; + actual = OS_SymbolTableDump("test", OSAL_SIZE_C(555)); + UtAssert_True(actual == expected, "OS_SymbolTableDump() (%ld) == OS_ERROR", (long)actual); } void Test_OS_ModuleGetInfo(void) @@ -274,6 +318,7 @@ void UtTest_Setup(void) ADD_TEST(OS_ModuleLoad); ADD_TEST(OS_ModuleUnload); ADD_TEST(OS_SymbolLookup); + ADD_TEST(OS_ModuleSymbolLookup); ADD_TEST(OS_ModuleGetInfo); ADD_TEST(OS_SymbolTableDump); ADD_TEST(OS_StaticSymbolLookup); diff --git a/src/unit-test-coverage/shared/src/coveragetest-mutex.c b/src/unit-test-coverage/shared/src/coveragetest-mutex.c index 5928c1d2e..d5a5158d1 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-mutex.c +++ b/src/unit-test-coverage/shared/src/coveragetest-mutex.c @@ -85,12 +85,26 @@ void Test_OS_MutSemGive(void) * Test Case For: * int32 OS_MutSemGive ( uint32 sem_id ) */ - int32 expected = OS_SUCCESS; - int32 actual = ~OS_SUCCESS; + OS_mutex_internal_record_t *mutex; + int32 expected; + int32 actual; - actual = OS_MutSemGive(UT_OBJID_1); + expected = OS_SUCCESS; + + /* Set up for "last owner" matching the calling task (nominal) */ + mutex = &OS_mutex_table[1]; + mutex->last_owner = OS_TaskGetId(); + actual = OS_MutSemGive(UT_OBJID_1); UtAssert_True(actual == expected, "OS_MutSemGive() (%ld) == OS_SUCCESS", (long)actual); + + /* owner should be unset */ + UtAssert_True(!OS_ObjectIdDefined(mutex->last_owner), "Mutex owner unset"); + + /* Call again when not "owned". This still works (or at least it calls the OS impl) + * but should generate a debug message */ + actual = OS_MutSemGive(UT_OBJID_1); + UtAssert_True(actual == expected, "OS_MutSemGive(), not owned (%ld) == OS_SUCCESS", (long)actual); } void Test_OS_MutSemTake(void) @@ -99,11 +113,24 @@ void Test_OS_MutSemTake(void) * Test Case For: * int32 OS_MutSemTake ( uint32 sem_id ) */ - int32 expected = OS_SUCCESS; - int32 actual = ~OS_SUCCESS; + OS_mutex_internal_record_t *mutex; + int32 expected; + int32 actual; - actual = OS_MutSemTake(UT_OBJID_1); + expected = OS_SUCCESS; + /* Set up for "last owner" being undefined (nominal) */ + mutex = &OS_mutex_table[1]; + mutex->last_owner = OS_OBJECT_ID_UNDEFINED; + actual = OS_MutSemTake(UT_OBJID_1); + UtAssert_True(actual == expected, "OS_MutSemTake() (%ld) == OS_SUCCESS", (long)actual); + + /* owner should be set */ + UtAssert_True(OS_ObjectIdDefined(mutex->last_owner), "Mutex owner set"); + + /* Call again when not already "owned". This still works (or at least it calls the OS impl) + * but should generate a debug message */ + actual = OS_MutSemTake(UT_OBJID_1); UtAssert_True(actual == expected, "OS_MutSemTake() (%ld) == OS_SUCCESS", (long)actual); } diff --git a/src/unit-test-coverage/shared/src/coveragetest-queue.c b/src/unit-test-coverage/shared/src/coveragetest-queue.c index 2ccd2ba98..44dab954f 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-queue.c +++ b/src/unit-test-coverage/shared/src/coveragetest-queue.c @@ -130,14 +130,20 @@ void Test_OS_QueuePut(void) int32 actual = ~OS_SUCCESS; const char Data[4] = "xyz"; - actual = OS_QueuePut(UT_OBJID_1, Data, sizeof(Data), 0); + OS_queue_table[1].max_depth = 10; + OS_queue_table[1].max_size = sizeof(Data); + actual = OS_QueuePut(UT_OBJID_1, Data, sizeof(Data), 0); UtAssert_True(actual == expected, "OS_QueuePut() (%ld) == OS_SUCCESS", (long)actual); /* test error cases */ expected = OS_INVALID_POINTER; actual = OS_QueuePut(UT_OBJID_1, NULL, sizeof(Data), 0); UtAssert_True(actual == expected, "OS_QueuePut() (%ld) == OS_INVALID_POINTER", (long)actual); + + expected = OS_QUEUE_INVALID_SIZE; + actual = OS_QueuePut(UT_OBJID_1, Data, 1 + sizeof(Data), 0); + UtAssert_True(actual == expected, "OS_QueuePut() (%ld) == OS_QUEUE_INVALID_SIZE", (long)actual); } void Test_OS_QueueGetIdByName(void) diff --git a/src/unit-test-coverage/shared/src/coveragetest-task.c b/src/unit-test-coverage/shared/src/coveragetest-task.c index 672a3e101..a97af4301 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-task.c +++ b/src/unit-test-coverage/shared/src/coveragetest-task.c @@ -109,7 +109,8 @@ void Test_OS_TaskCreate(void) osal_id_t objid; int32 actual; - actual = OS_TaskCreate(&objid, "UT", UT_TestHook, OSAL_TASK_STACK_ALLOCATE, OSAL_SIZE_C(128), OSAL_PRIORITY_C(0), 0); + actual = + OS_TaskCreate(&objid, "UT", UT_TestHook, OSAL_TASK_STACK_ALLOCATE, OSAL_SIZE_C(128), OSAL_PRIORITY_C(0), 0); UtAssert_True(actual == expected, "OS_TaskCreate() (%ld) == OS_SUCCESS", (long)actual); OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED); @@ -255,7 +256,8 @@ void Test_OS_TaskGetInfo(void) UtAssert_True(actual == expected, "OS_TaskGetInfo() (%ld) == OS_SUCCESS", (long)actual); OSAPI_TEST_OBJID(task_prop.creator, ==, UT_OBJID_OTHER); UtAssert_True(strcmp(task_prop.name, "ABC") == 0, "task_prop.name (%s) == ABC", task_prop.name); - UtAssert_True(task_prop.stack_size == 222, "task_prop.stack_size (%lu) == 222", (unsigned long)task_prop.stack_size); + UtAssert_True(task_prop.stack_size == 222, "task_prop.stack_size (%lu) == 222", + (unsigned long)task_prop.stack_size); UtAssert_True(task_prop.priority == 133, "task_prop.priority (%lu) == 133", (unsigned long)task_prop.priority); OS_task_table[1].stack_size = OSAL_SIZE_C(0); diff --git a/src/unit-test-coverage/shared/src/coveragetest-time.c b/src/unit-test-coverage/shared/src/coveragetest-time.c index bb81ff0d2..9e90abcc5 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-time.c +++ b/src/unit-test-coverage/shared/src/coveragetest-time.c @@ -154,6 +154,14 @@ void Test_OS_TimerCreate(void) actual = OS_TimerCreate(&objid, "UT", &accuracy, UT_TimerCallback); UtAssert_True(actual == expected, "OS_TimerCreate() (%ld) == OS_ERR_NAME_TOO_LONG", (long)actual); UT_ClearDefaultReturnValue(UT_KEY(OCS_memchr)); + + /* This function creates its own timebase. If OS_DoTimerAdd() fails this timebase needs to be deleted */ + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERROR); + expected = OS_ERROR; + actual = OS_TimerCreate(&objid, "UT", &accuracy, UT_TimerCallback); + UtAssert_True(actual == expected, "OS_TimerCreate() (%ld) == OS_ERROR", (long)actual); + UT_ResetState(UT_KEY(OS_ObjectIdGetById)); + UtAssert_STUB_COUNT(OS_TimeBaseDelete, 1); } void Test_OS_TimerSet(void) @@ -195,35 +203,56 @@ void Test_OS_TimerDelete(void) * Test Case For: * int32 OS_TimerDelete(uint32 timer_id) */ - int32 expected = OS_SUCCESS; - int32 actual = OS_TimerDelete(UT_OBJID_1); - osal_id_t timebase_id; + int32 expected; + int32 actual; + osal_id_t timebase_id; + osal_id_t timer_objid_1, timer_objid_2; + OS_timebase_internal_record_t *timebase; + OS_object_token_t timebase_token; + uint32 accuracy; + + expected = OS_SUCCESS; + + /* The ObjIds in the ring need to match what will be in the token */ + /* Get a "timebase" from the stub so the objid will validate */ + OS_TimeBaseCreate(&timebase_id, "ut", NULL); + OS_ObjectIdGetById(OS_LOCK_MODE_NONE, OS_OBJECT_TYPE_OS_TIMEBASE, timebase_id, &timebase_token); + timebase = OS_OBJECT_TABLE_GET(OS_timebase_table, timebase_token); + OS_TimerAdd(&timer_objid_1, "UT1", timebase_id, UT_TimerArgCallback, NULL); + OS_TimerAdd(&timer_objid_2, "UT2", timebase_id, UT_TimerArgCallback, NULL); + + /* Sanity check: After adding the two timers the "first_cb" should be pointing at timer 2 */ + UtAssert_True(OS_ObjectIdEqual(timebase->first_cb, timer_objid_2), "First CB at timer 2"); + actual = OS_TimerDelete(timer_objid_2); UtAssert_True(actual == expected, "OS_TimerDelete() (%ld) == OS_SUCCESS", (long)actual); - OS_timecb_table[1].timebase_token.obj_type = OS_OBJECT_TYPE_OS_TIMEBASE; - OS_timecb_table[1].timebase_token.obj_id = UT_OBJID_1; - OS_timecb_table[1].timebase_token.obj_idx = UT_INDEX_0; - OS_timecb_table[2].timebase_token = OS_timecb_table[1].timebase_token; - OS_timecb_table[2].next_cb = UT_OBJID_1; - OS_timecb_table[1].next_cb = UT_OBJID_1; - OS_timebase_table[0].first_cb = UT_OBJID_2; - actual = OS_TimerDelete(UT_OBJID_2); + /* After deleting timer 2 the "first_cb" should be pointing at timer 1 */ + UtAssert_True(OS_ObjectIdEqual(timebase->first_cb, timer_objid_1), "First CB at timer 1"); + + /* Re-add timer 2 again */ + OS_TimerAdd(&timer_objid_2, "UT2", timebase_id, UT_TimerArgCallback, NULL); + + /* Sanity check: the "first_cb" should be pointing at timer 2 again */ + UtAssert_True(OS_ObjectIdEqual(timebase->first_cb, timer_objid_2), "First CB at timer 2"); + + /* delete timer 1 */ + actual = OS_TimerDelete(timer_objid_1); UtAssert_True(actual == expected, "OS_TimerDelete() (%ld) == OS_SUCCESS", (long)actual); - OS_timebase_table[0].first_cb = UT_OBJID_1; - actual = OS_TimerDelete(UT_OBJID_1); + /* The "first_cb" should be still pointing at timer 2 */ + UtAssert_True(OS_ObjectIdEqual(timebase->first_cb, timer_objid_2), "First CB at timer 2"); + + actual = OS_TimerDelete(timer_objid_2); UtAssert_True(actual == expected, "OS_TimerDelete() (%ld) == OS_SUCCESS", (long)actual); + /* The "first_cb" should be undefined */ + UtAssert_True(!OS_ObjectIdDefined(timebase->first_cb), "First CB at OS_OBJECT_ID_UNDEFINED"); + /* verify deletion of the dedicated timebase objects * these are implicitly created as part of timer creation for API compatibility */ - OS_TimeBaseCreate(&timebase_id, "ut", NULL); - OS_UT_SetupTestTargetIndex(OS_OBJECT_TYPE_OS_TIMECB, UT_INDEX_1); - OS_timecb_table[1].flags = TIMECB_FLAG_DEDICATED_TIMEBASE; - OS_timecb_table[1].timebase_token.obj_type = OS_OBJECT_TYPE_OS_TIMEBASE; - OS_timecb_table[1].timebase_token.obj_id = timebase_id; - OS_timecb_table[1].timebase_token.obj_idx = OS_ObjectIdToInteger(timebase_id) & OS_OBJECT_INDEX_MASK; - actual = OS_TimerDelete(UT_OBJID_1); + OS_TimerCreate(&timer_objid_1, "UT1", &accuracy, UT_TimerCallback); + actual = OS_TimerDelete(timer_objid_1); UtAssert_True(actual == expected, "OS_TimerDelete() (%ld) == OS_SUCCESS", (long)actual); UtAssert_True(UT_GetStubCount(UT_KEY(OS_TimeBaseDelete)) == 1, "OS_TimerDelete() invoked OS_TimeBaseDelete()"); diff --git a/src/unit-test-coverage/shared/src/os-shared-coveragetest.h b/src/unit-test-coverage/shared/src/os-shared-coveragetest.h index 4244a99d5..bfefc17d0 100644 --- a/src/unit-test-coverage/shared/src/os-shared-coveragetest.h +++ b/src/unit-test-coverage/shared/src/os-shared-coveragetest.h @@ -113,4 +113,4 @@ void Osapi_Test_Setup(void); */ void Osapi_Test_Teardown(void); -#endif /* OS_SHARED_COVERAGETEST_H */ +#endif /* OS_SHARED_COVERAGETEST_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_arpa_inet.h b/src/unit-test-coverage/ut-stubs/inc/OCS_arpa_inet.h index d75e8a18f..77128e614 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_arpa_inet.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_arpa_inet.h @@ -39,4 +39,4 @@ extern const char *OCS_inet_ntop(int af, const void *cp, char *buf, size_t len); extern int OCS_inet_pton(int af, const char *cp, void *buf); -#endif /* OCS_ARPA_INET_H */ +#endif /* OCS_ARPA_INET_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_assert.h b/src/unit-test-coverage/ut-stubs/inc/OCS_assert.h index 6018cf0da..fc23e44d3 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_assert.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_assert.h @@ -38,4 +38,4 @@ void OCS_assert(bool expression); -#endif /* OCS_ASSERT_H */ +#endif /* OCS_ASSERT_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_basetypes.h b/src/unit-test-coverage/ut-stubs/inc/OCS_basetypes.h index ec19105b5..0d1098e6f 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_basetypes.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_basetypes.h @@ -36,4 +36,4 @@ #include /* for correct INT_MAX, etc. */ #include /* for correct boolean semantics */ -#endif /* OCS_BASETYPES_H */ +#endif /* OCS_BASETYPES_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_blkIo.h b/src/unit-test-coverage/ut-stubs/inc/OCS_blkIo.h index dae8c8643..8816c7f42 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_blkIo.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_blkIo.h @@ -32,4 +32,4 @@ typedef struct OCS_BLK_DEV } OCS_BLK_DEV; typedef OCS_BLK_DEV *OCS_BLK_DEV_ID; -#endif /* OCS_BLKIO_H */ +#endif /* OCS_BLKIO_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_bsp-impl.h b/src/unit-test-coverage/ut-stubs/inc/OCS_bsp-impl.h index e14d43cf2..f0a285402 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_bsp-impl.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_bsp-impl.h @@ -90,4 +90,4 @@ extern void OCS_OS_BSP_ConsoleOutput_Impl(const char *Str, size_t DataLen); ------------------------------------------------------------------*/ extern void OCS_OS_BSP_ConsoleSetMode_Impl(uint32_t ModeBits); -#endif /* OCS_BSP_IMPL_H */ +#endif /* OCS_BSP_IMPL_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_cbioLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_cbioLib.h index 655b0f8d7..cfabf811b 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_cbioLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_cbioLib.h @@ -37,4 +37,4 @@ /* prototypes normally declared in cbioLib.h */ /* ----------------------------------------- */ -#endif /* OCS_CBIOLIB_H */ +#endif /* OCS_CBIOLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_complex.h b/src/unit-test-coverage/ut-stubs/inc/OCS_complex.h index 011fb2e12..2e68e379d 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_complex.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_complex.h @@ -36,4 +36,4 @@ /* prototypes normally declared in complex.h */ /* ----------------------------------------- */ -#endif /* OCS_COMPLEX_H */ +#endif /* OCS_COMPLEX_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_ctype.h b/src/unit-test-coverage/ut-stubs/inc/OCS_ctype.h index 254eb0183..f68aa8b0b 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_ctype.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_ctype.h @@ -38,4 +38,4 @@ extern int OCS_isgraph(int c); -#endif /* OCS_CTYPE_H */ +#endif /* OCS_CTYPE_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_dirent.h b/src/unit-test-coverage/ut-stubs/inc/OCS_dirent.h index 44089bb73..af9ce8418 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_dirent.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_dirent.h @@ -48,4 +48,4 @@ extern OCS_DIR * OCS_opendir(const char *name); extern struct OCS_dirent *OCS_readdir(OCS_DIR *dirp); extern void OCS_rewinddir(OCS_DIR *dirp); -#endif /* OCS_DIRENT_H */ +#endif /* OCS_DIRENT_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_dlfcn.h b/src/unit-test-coverage/ut-stubs/inc/OCS_dlfcn.h index e576ff3ee..fe8934a17 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_dlfcn.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_dlfcn.h @@ -41,4 +41,4 @@ extern char *OCS_dlerror(void); extern void *OCS_dlopen(const char *file, int flags); extern void *OCS_dlsym(void *handle, const char *name); -#endif /* OCS_DLFCN_H */ +#endif /* OCS_DLFCN_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_dosFsLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_dosFsLib.h index e17165a44..1f783ecf2 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_dosFsLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_dosFsLib.h @@ -43,4 +43,4 @@ /* ----------------------------------------- */ extern OCS_STATUS OCS_dosFsVolFormat(char *path, int opt, OCS_FUNCPTR pPromptFunc); -#endif /* OCS_DOSFSLIB_H */ +#endif /* OCS_DOSFSLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_drv_hdisk_ataDrv.h b/src/unit-test-coverage/ut-stubs/inc/OCS_drv_hdisk_ataDrv.h index 2e87822c1..65c63d700 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_drv_hdisk_ataDrv.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_drv_hdisk_ataDrv.h @@ -39,4 +39,4 @@ /* ----------------------------------------- */ extern OCS_BLK_DEV *OCS_ataDevCreate(int ctrl, int drive, unsigned int nBlocks, unsigned int blkOffset); -#endif /* OCS_DRV_HDISK_ATADRV_H */ +#endif /* OCS_DRV_HDISK_ATADRV_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_errno.h b/src/unit-test-coverage/ut-stubs/inc/OCS_errno.h index 290ed09fe..79c123e0d 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_errno.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_errno.h @@ -49,4 +49,4 @@ extern int OCS_errno; -#endif /* OCS_ERRNO_H */ +#endif /* OCS_ERRNO_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_errnoLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_errnoLib.h index 88cbb5563..73b0c2039 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_errnoLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_errnoLib.h @@ -39,4 +39,4 @@ extern int OCS_errnoGet(void); -#endif /* OCS_ERRNOLIB_H */ +#endif /* OCS_ERRNOLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_fcntl.h b/src/unit-test-coverage/ut-stubs/inc/OCS_fcntl.h index 48408b35c..b1ab963f9 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_fcntl.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_fcntl.h @@ -81,4 +81,4 @@ extern int OCS_fcntl(int fd, int cmd, ...); extern int OCS_open(const char *file, int oflag, ...); -#endif /* OCS_FCNTL_H */ +#endif /* OCS_FCNTL_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_fenv.h b/src/unit-test-coverage/ut-stubs/inc/OCS_fenv.h index b1a9bc92d..aba58fad0 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_fenv.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_fenv.h @@ -36,4 +36,4 @@ /* prototypes normally declared in fenv.h */ /* ----------------------------------------- */ -#endif /* OCS_FENV_H */ +#endif /* OCS_FENV_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_float.h b/src/unit-test-coverage/ut-stubs/inc/OCS_float.h index afc4cb397..97cab7bbc 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_float.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_float.h @@ -36,4 +36,4 @@ /* prototypes normally declared in float.h */ /* ----------------------------------------- */ -#endif /* OCS_FLOAT_H */ +#endif /* OCS_FLOAT_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_hostLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_hostLib.h index a070b2533..ed9e020a3 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_hostLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_hostLib.h @@ -44,4 +44,4 @@ /* ----------------------------------------- */ extern int OCS_hostGetByName(char *name); -#endif /* OCS_HOSTLIB_H */ +#endif /* OCS_HOSTLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_intLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_intLib.h index 45d0ad544..724f8396b 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_intLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_intLib.h @@ -44,4 +44,4 @@ extern int OCS_intLock(void); extern int OCS_intUnlock(int lockKey); extern OCS_VOIDFUNCPTR *OCS_INUM_TO_IVEC(unsigned int ui); -#endif /* OCS_INTLIB_H */ +#endif /* OCS_INTLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_inttypes.h b/src/unit-test-coverage/ut-stubs/inc/OCS_inttypes.h index 700c9c822..0b326e904 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_inttypes.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_inttypes.h @@ -36,4 +36,4 @@ /* prototypes normally declared in inttypes.h */ /* ----------------------------------------- */ -#endif /* OCS_INTTYPES_H */ +#endif /* OCS_INTTYPES_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_ioLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_ioLib.h index bee9238ec..6e8dd63d7 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_ioLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_ioLib.h @@ -42,4 +42,4 @@ extern int OCS_ioctl(int fd, unsigned long request, ...); -#endif /* OCS_IOLIB_H */ +#endif /* OCS_IOLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_iv.h b/src/unit-test-coverage/ut-stubs/inc/OCS_iv.h index 8252f66e0..5ddb8182e 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_iv.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_iv.h @@ -24,4 +24,4 @@ #include -#endif /* OCS_IV_H */ +#endif /* OCS_IV_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_loadLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_loadLib.h index d042c16de..b9eb5abc6 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_loadLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_loadLib.h @@ -40,4 +40,4 @@ extern OCS_MODULE_ID OCS_loadModule(int fd, unsigned int symFlag); -#endif /* OCS_LOADLIB_H */ +#endif /* OCS_LOADLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_locale.h b/src/unit-test-coverage/ut-stubs/inc/OCS_locale.h index 278ced3ce..40d070f8e 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_locale.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_locale.h @@ -36,4 +36,4 @@ /* prototypes normally declared in locale.h */ /* ----------------------------------------- */ -#endif /* OCS_LOCALE_H */ +#endif /* OCS_LOCALE_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_logLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_logLib.h index 22de5a19a..0eb53f915 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_logLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_logLib.h @@ -37,4 +37,4 @@ /* prototypes normally declared in logLib.h */ /* ----------------------------------------- */ -#endif /* OCS_LOGLIB_H */ +#endif /* OCS_LOGLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_math.h b/src/unit-test-coverage/ut-stubs/inc/OCS_math.h index a8cfe8c28..3b07bce2d 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_math.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_math.h @@ -36,4 +36,4 @@ /* prototypes normally declared in math.h */ /* ----------------------------------------- */ -#endif /* OCS_MATH_H */ +#endif /* OCS_MATH_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_memPartLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_memPartLib.h index c0a7b1935..d1201761a 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_memPartLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_memPartLib.h @@ -54,4 +54,4 @@ extern OCS_STATUS OCS_memPartInfoGet(OCS_PART_ID partId, /* partition ID extern OCS_PART_ID OCS_memSysPartId; -#endif /* OCS_MEMPARTLIB_H */ +#endif /* OCS_MEMPARTLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_moduleLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_moduleLib.h index 63c73db4c..a7b3ca224 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_moduleLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_moduleLib.h @@ -58,4 +58,4 @@ typedef struct OCS_MODULE_INFO extern OCS_STATUS OCS_moduleInfoGet(OCS_MODULE_ID moduleId, OCS_MODULE_INFO *pModuleInfo); -#endif /* OCS_MODULELIB_H */ +#endif /* OCS_MODULELIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_mqueue.h b/src/unit-test-coverage/ut-stubs/inc/OCS_mqueue.h index d317d4f22..da7ae4eb9 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_mqueue.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_mqueue.h @@ -55,4 +55,4 @@ extern int OCS_mq_timedsend(OCS_mqd_t mqdes, const char *msg_ptr, size_t const struct OCS_timespec *abs_timeout); extern int OCS_mq_unlink(const char *name); -#endif /* OCS_MQUEUE_H */ +#endif /* OCS_MQUEUE_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_msgQLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_msgQLib.h index 5a5086671..46e540cc7 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_msgQLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_msgQLib.h @@ -54,4 +54,4 @@ extern OCS_STATUS OCS_msgQDelete(OCS_MSG_Q_ID msgQId); extern int OCS_msgQReceive(OCS_MSG_Q_ID msgQId, char *buffer, OCS_UINT maxNBytes, int timeout); extern OCS_STATUS OCS_msgQSend(OCS_MSG_Q_ID msgQId, char *buffer, OCS_UINT nBytes, int timeout, int priority); -#endif /* OCS_MSGQLIB_H */ +#endif /* OCS_MSGQLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_net_if.h b/src/unit-test-coverage/ut-stubs/inc/OCS_net_if.h index c1dafe5b3..b04003749 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_net_if.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_net_if.h @@ -36,4 +36,4 @@ /* prototypes normally declared in net/if.h */ /* ----------------------------------------- */ -#endif /* OCS_NET_IF_H */ +#endif /* OCS_NET_IF_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_netdb.h b/src/unit-test-coverage/ut-stubs/inc/OCS_netdb.h index bd1390376..69aedbfad 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_netdb.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_netdb.h @@ -36,4 +36,4 @@ /* prototypes normally declared in netdb.h */ /* ----------------------------------------- */ -#endif /* OCS_NETDB_H */ +#endif /* OCS_NETDB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_netinet_in.h b/src/unit-test-coverage/ut-stubs/inc/OCS_netinet_in.h index cd9bba777..db4194a17 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_netinet_in.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_netinet_in.h @@ -41,4 +41,4 @@ extern uint16_t OCS_ntohs(uint16_t netshort); extern uint32_t OCS_htonl(uint32_t hostlong); extern uint32_t OCS_ntohl(uint32_t netlong); -#endif /* OCS_NETINET_IN_H */ +#endif /* OCS_NETINET_IN_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_netinet_tcp.h b/src/unit-test-coverage/ut-stubs/inc/OCS_netinet_tcp.h index 8c5e03ef6..e9a89fa26 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_netinet_tcp.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_netinet_tcp.h @@ -36,4 +36,4 @@ /* prototypes normally declared in netinet/tcp.h */ /* ----------------------------------------- */ -#endif /* OCS_NETINET_TCP_H */ +#endif /* OCS_NETINET_TCP_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_objLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_objLib.h index 1b01331f0..12716d859 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_objLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_objLib.h @@ -44,4 +44,4 @@ /* prototypes normally declared in objLib.h */ /* ----------------------------------------- */ -#endif /* OCS_OBJLIB_H */ +#endif /* OCS_OBJLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_poll.h b/src/unit-test-coverage/ut-stubs/inc/OCS_poll.h index d9c58f557..471ebf757 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_poll.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_poll.h @@ -36,4 +36,4 @@ /* prototypes normally declared in poll.h */ /* ----------------------------------------- */ -#endif /* OCS_POLL_H */ +#endif /* OCS_POLL_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_pthread.h b/src/unit-test-coverage/ut-stubs/inc/OCS_pthread.h index 20bd35c3f..975513806 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_pthread.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_pthread.h @@ -122,4 +122,4 @@ extern int OCS_pthread_setschedprio(OCS_pthread_t target_thread, int prio); extern int OCS_pthread_setspecific(OCS_pthread_key_t key, const void *pointer); extern int OCS_pthread_sigmask(int how, const OCS_sigset_t *set, OCS_sigset_t *oldset); -#endif /* OCS_PTHREAD_H */ +#endif /* OCS_PTHREAD_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_ramDiskCbio.h b/src/unit-test-coverage/ut-stubs/inc/OCS_ramDiskCbio.h index 9a5f65856..1eb14362d 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_ramDiskCbio.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_ramDiskCbio.h @@ -37,4 +37,4 @@ /* prototypes normally declared in ramDiskCbio.h */ /* ----------------------------------------- */ -#endif /* OCS_RAMDISKCBIO_H */ +#endif /* OCS_RAMDISKCBIO_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_ramDrv.h b/src/unit-test-coverage/ut-stubs/inc/OCS_ramDrv.h index faa89be57..6b6ce2e44 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_ramDrv.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_ramDrv.h @@ -39,4 +39,4 @@ /* ----------------------------------------- */ extern OCS_BLK_DEV *OCS_ramDevCreate(char *ramAddr, int bytesPerSec, int secPerTrack, int nSectors, int secOffset); -#endif /* OCS_RAMDRV_H */ +#endif /* OCS_RAMDRV_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_sched.h b/src/unit-test-coverage/ut-stubs/inc/OCS_sched.h index 14ca9fe5d..ceae63638 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_sched.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_sched.h @@ -45,4 +45,4 @@ struct OCS_sched_param extern int OCS_sched_get_priority_max(int policy); extern int OCS_sched_get_priority_min(int policy); -#endif /* OCS_SCHED_H */ +#endif /* OCS_SCHED_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_semLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_semLib.h index e6c386a0c..aedc0d2b2 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_semLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_semLib.h @@ -70,4 +70,4 @@ extern OCS_STATUS OCS_semFlush(OCS_SEM_ID semId); extern OCS_STATUS OCS_semTake(OCS_SEM_ID semId, int timeout); extern OCS_STATUS OCS_semGive(OCS_SEM_ID semId); -#endif /* OCS_SEMLIB_H */ +#endif /* OCS_SEMLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_semaphore.h b/src/unit-test-coverage/ut-stubs/inc/OCS_semaphore.h index be7862691..b05c25df5 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_semaphore.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_semaphore.h @@ -49,4 +49,4 @@ extern int OCS_sem_post(OCS_sem_t *sem); extern int OCS_sem_timedwait(OCS_sem_t *sem, const struct OCS_timespec *abstime); extern int OCS_sem_wait(OCS_sem_t *sem); -#endif /* OCS_SEMAPHORE_H */ +#endif /* OCS_SEMAPHORE_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_setjmp.h b/src/unit-test-coverage/ut-stubs/inc/OCS_setjmp.h index 63ac867f2..febc81156 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_setjmp.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_setjmp.h @@ -36,4 +36,4 @@ /* prototypes normally declared in setjmp.h */ /* ----------------------------------------- */ -#endif /* OCS_SETJMP_H */ +#endif /* OCS_SETJMP_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_shellLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_shellLib.h index c79987ce8..4f316da0b 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_shellLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_shellLib.h @@ -40,4 +40,4 @@ extern OCS_STATUS OCS_shellGenericInit(const char *config, int stackSize, const char *shellName, char **pShellName, OCS_BOOL interactive, OCS_BOOL loginAccess, int fdin, int fdout, int fderr); -#endif /* OCS_SHELLLIB_H */ +#endif /* OCS_SHELLLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_signal.h b/src/unit-test-coverage/ut-stubs/inc/OCS_signal.h index dfdda0041..13990a46f 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_signal.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_signal.h @@ -74,4 +74,4 @@ extern int OCS_sigprocmask(int how, const OCS_sigset_t *set, OCS_si extern int OCS_sigsuspend(const OCS_sigset_t *set); extern int OCS_sigwait(const OCS_sigset_t *set, int *sig); -#endif /* OCS_SIGNAL_H */ +#endif /* OCS_SIGNAL_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_stat.h b/src/unit-test-coverage/ut-stubs/inc/OCS_stat.h index 79c52ae17..bc2702ae5 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_stat.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_stat.h @@ -74,4 +74,4 @@ extern int OCS_fstat(int fd, struct OCS_stat *buf); extern int OCS_statvfs(const char *file, struct OCS_statvfs *buf); -#endif /* OCS_STAT_H */ +#endif /* OCS_STAT_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_stdarg.h b/src/unit-test-coverage/ut-stubs/inc/OCS_stdarg.h index b0299c8d1..b788b203f 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_stdarg.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_stdarg.h @@ -43,4 +43,4 @@ typedef struct #define OCS_va_start(ap, last) ap.p = &last #define OCS_va_end(ap) -#endif /* OCS_STDARG_H */ +#endif /* OCS_STDARG_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_stdio.h b/src/unit-test-coverage/ut-stubs/inc/OCS_stdio.h index f6fa1fb37..31ce73425 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_stdio.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_stdio.h @@ -54,4 +54,4 @@ extern OCS_FILE *OCS_stdin; extern OCS_FILE *OCS_stdout; extern OCS_FILE *OCS_stderr; -#endif /* OCS_STDIO_H */ +#endif /* OCS_STDIO_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_stdlib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_stdlib.h index 21f58f107..b0fe69988 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_stdlib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_stdlib.h @@ -46,4 +46,4 @@ extern int OCS_system(const char *command); extern void * OCS_malloc(size_t sz); extern void OCS_free(void *ptr); -#endif /* OCS_STDLIB_H */ +#endif /* OCS_STDLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_string.h b/src/unit-test-coverage/ut-stubs/inc/OCS_string.h index f58965910..470ba2e82 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_string.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_string.h @@ -50,4 +50,4 @@ extern char * OCS_strcat(char *dest, const char *src); extern char * OCS_strncat(char *dest, const char *src, size_t n); extern char * OCS_strerror(int errnum); -#endif /* OCS_STRING_H */ +#endif /* OCS_STRING_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_strings.h b/src/unit-test-coverage/ut-stubs/inc/OCS_strings.h index b71872507..74e2c5cab 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_strings.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_strings.h @@ -36,4 +36,4 @@ /* prototypes normally declared in strings.h */ /* ----------------------------------------- */ -#endif /* OCS_STRINGS_H */ +#endif /* OCS_STRINGS_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_symLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_symLib.h index 69b886112..16037a4f8 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_symLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_symLib.h @@ -70,4 +70,4 @@ extern OCS_STATUS OCS_symFindByName(OCS_SYMTAB_ID symTblId, char *name, char ** extern OCS_SYMBOL *OCS_symEach(OCS_SYMTAB_ID symTblId, OCS_symEach_Routine_t routine, int routineArg); extern OCS_STATUS OCS_symFind(OCS_SYMTAB_ID symTblId, OCS_SYMBOL_DESC *pSymbol); -#endif /* OCS_SYMLIB_H */ +#endif /* OCS_SYMLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_sysLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_sysLib.h index 06b96ff7d..0f6093256 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_sysLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_sysLib.h @@ -38,4 +38,4 @@ /* ----------------------------------------- */ extern int OCS_sysClkRateGet(void); -#endif /* OCS_SYSLIB_H */ +#endif /* OCS_SYSLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_ioctl.h b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_ioctl.h index 3a09a9486..60ef5e79e 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_ioctl.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_ioctl.h @@ -38,4 +38,4 @@ extern int OCS_ioctl(int fd, unsigned long request, ...); -#endif /* OCS_SYS_IOCTL_H */ +#endif /* OCS_SYS_IOCTL_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_ipc.h b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_ipc.h index f2f8b58ad..f566826f2 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_ipc.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_ipc.h @@ -36,4 +36,4 @@ /* prototypes normally declared in sys/ipc.h */ /* ----------------------------------------- */ -#endif /* OCS_SYS_IPC_H */ +#endif /* OCS_SYS_IPC_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_mman.h b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_mman.h index dab686d11..7bdff049f 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_mman.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_mman.h @@ -45,4 +45,4 @@ void *OCS_mmap(void *addr, size_t length, int prot, int flags, int fd, OCS_off_t offset); int OCS_munmap(void *addr, size_t length); -#endif /* OCS_SYS_MMAN_H */ +#endif /* OCS_SYS_MMAN_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_select.h b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_select.h index 627c1df4a..531cad372 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_select.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_select.h @@ -55,4 +55,4 @@ extern int OCS_FD_ISSET(int fd, OCS_fd_set *set); extern void OCS_FD_CLR(int fd, OCS_fd_set *set); extern void OCS_FD_ZERO(OCS_fd_set *set); -#endif /* OCS_SYS_SELECT_H */ +#endif /* OCS_SYS_SELECT_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_socket.h b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_socket.h index f87ababdc..35e079f03 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_socket.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_socket.h @@ -55,4 +55,4 @@ extern OCS_ssize_t OCS_sendto(int fd, const void *buf, size_t n, int flags, cons extern int OCS_setsockopt(int fd, int level, int optname, const void *optval, OCS_socklen_t optlen); extern int OCS_socket(int domain, int type, int protocol); -#endif /* OCS_SYS_SOCKET_H */ +#endif /* OCS_SYS_SOCKET_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_time.h b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_time.h index 8f905ab12..54b7044b3 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_time.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_time.h @@ -37,4 +37,4 @@ /* prototypes normally declared in sys/time.h */ /* ----------------------------------------- */ -#endif /* OCS_SYS_TIME_H */ +#endif /* OCS_SYS_TIME_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_times.h b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_times.h index 3957d99a6..3f92ec9ca 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_times.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_times.h @@ -37,4 +37,4 @@ /* prototypes normally declared in sys/times.h */ /* ----------------------------------------- */ -#endif /* OCS_SYS_TIMES_H */ +#endif /* OCS_SYS_TIMES_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_types.h b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_types.h index 40158454f..c3db9b65f 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_types.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_types.h @@ -43,4 +43,4 @@ typedef int OCS_uid_t; /* prototypes normally declared in sys/types.h */ /* ----------------------------------------- */ -#endif /* OCS_SYS_TYPES_H */ +#endif /* OCS_SYS_TYPES_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_un.h b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_un.h index a5d62205f..197ea1840 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_un.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_un.h @@ -36,4 +36,4 @@ /* prototypes normally declared in sys/un.h */ /* ----------------------------------------- */ -#endif /* OCS_SYS_UN_H */ +#endif /* OCS_SYS_UN_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_wait.h b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_wait.h index be91da5ce..6ec53b345 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_sys_wait.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_sys_wait.h @@ -36,4 +36,4 @@ /* prototypes normally declared in sys/wait.h */ /* ----------------------------------------- */ -#endif /* OCS_SYS_WAIT_H */ +#endif /* OCS_SYS_WAIT_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_taskLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_taskLib.h index 72a7b7e63..bc2bccc39 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_taskLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_taskLib.h @@ -79,4 +79,4 @@ OCS_STATUS OCS_taskInit(OCS_WIND_TCB *pTcb, char *name, int priority, int option OCS_WIND_TCB *OCS_taskTcb(OCS_TASK_ID tid); -#endif /* OCS_TASKLIB_H */ +#endif /* OCS_TASKLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_taskVarLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_taskVarLib.h index 332998e47..9ac4f3937 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_taskVarLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_taskVarLib.h @@ -39,4 +39,4 @@ extern OCS_STATUS OCS_taskVarAdd(int tid, int *pVar); -#endif /* OCS_TASKVARLIB_H */ +#endif /* OCS_TASKVARLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_termios.h b/src/unit-test-coverage/ut-stubs/inc/OCS_termios.h index 70b3dcc17..6420fa2d0 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_termios.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_termios.h @@ -36,4 +36,4 @@ /* prototypes normally declared in termios.h */ /* ----------------------------------------- */ -#endif /* OCS_TERMIOS_H */ +#endif /* OCS_TERMIOS_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_tgmath.h b/src/unit-test-coverage/ut-stubs/inc/OCS_tgmath.h index 7cb26cf0e..b547b841a 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_tgmath.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_tgmath.h @@ -36,4 +36,4 @@ /* prototypes normally declared in tgmath.h */ /* ----------------------------------------- */ -#endif /* OCS_TGMATH_H */ +#endif /* OCS_TGMATH_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_time.h b/src/unit-test-coverage/ut-stubs/inc/OCS_time.h index 003b2f3b1..20894c1b6 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_time.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_time.h @@ -79,4 +79,4 @@ extern int OCS_timer_settime(OCS_timer_t timerid, int flags, const struct OCS_it extern int OCS_timer_connect(OCS_timer_t timerid, OCS_TIMER_CONNECT_FUNC func, int arg); -#endif /* OCS_TIME_H */ +#endif /* OCS_TIME_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_timers.h b/src/unit-test-coverage/ut-stubs/inc/OCS_timers.h index f80d25d27..be5085b59 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_timers.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_timers.h @@ -36,4 +36,4 @@ /* prototypes normally declared in timers.h */ /* ----------------------------------------- */ -#endif /* OCS_TIMERS_H */ +#endif /* OCS_TIMERS_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_ulimit.h b/src/unit-test-coverage/ut-stubs/inc/OCS_ulimit.h index 3b9453282..153150bec 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_ulimit.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_ulimit.h @@ -37,4 +37,4 @@ /* ----------------------------------------- */ long OCS_ulimit(int cmd, long newlimit); -#endif /* OCS_ULIMIT_H */ +#endif /* OCS_ULIMIT_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_unistd.h b/src/unit-test-coverage/ut-stubs/inc/OCS_unistd.h index 565924255..34a5d4c1c 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_unistd.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_unistd.h @@ -56,4 +56,4 @@ extern int OCS_rmdir(const char *path); extern long int OCS_sysconf(int name); extern OCS_ssize_t OCS_write(int fd, const void *buf, size_t n); -#endif /* OCS_UNISTD_H */ +#endif /* OCS_UNISTD_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_unldLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_unldLib.h index 2f1c709b7..c3de289e7 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_unldLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_unldLib.h @@ -39,4 +39,4 @@ /* ----------------------------------------- */ extern OCS_STATUS OCS_unldByModuleId(OCS_MODULE_ID moduleId, int options); -#endif /* OCS_UNLDLIB_H */ +#endif /* OCS_UNLDLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_usrLib.h b/src/unit-test-coverage/ut-stubs/inc/OCS_usrLib.h index f45e873f2..bc8c9127a 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_usrLib.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_usrLib.h @@ -37,4 +37,4 @@ /* prototypes normally declared in usrLib.h */ /* ----------------------------------------- */ -#endif /* OCS_USRLIB_H */ +#endif /* OCS_USRLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_version.h b/src/unit-test-coverage/ut-stubs/inc/OCS_version.h index 203e8e828..89766255f 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_version.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_version.h @@ -36,4 +36,4 @@ /* prototypes normally declared in version.h */ /* ----------------------------------------- */ -#endif /* OCS_VERSION_H */ +#endif /* OCS_VERSION_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_vxWorks.h b/src/unit-test-coverage/ut-stubs/inc/OCS_vxWorks.h index 6b4f24d6b..6db9b9300 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_vxWorks.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_vxWorks.h @@ -76,4 +76,4 @@ typedef void (*OCS_VOIDFUNCPTR)(void); /* prototypes normally declared in vxWorks.h */ /* ----------------------------------------- */ -#endif /* OCS_VXWORKS_H */ +#endif /* OCS_VXWORKS_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_wchar.h b/src/unit-test-coverage/ut-stubs/inc/OCS_wchar.h index dd9fb6709..050413681 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_wchar.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_wchar.h @@ -36,4 +36,4 @@ /* prototypes normally declared in wchar.h */ /* ----------------------------------------- */ -#endif /* OCS_WCHAR_H */ +#endif /* OCS_WCHAR_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_wctype.h b/src/unit-test-coverage/ut-stubs/inc/OCS_wctype.h index a7d975dee..0aa046df6 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_wctype.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_wctype.h @@ -36,4 +36,4 @@ /* prototypes normally declared in wctype.h */ /* ----------------------------------------- */ -#endif /* OCS_WCTYPE_H */ +#endif /* OCS_WCTYPE_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_xbdBlkDev.h b/src/unit-test-coverage/ut-stubs/inc/OCS_xbdBlkDev.h index f805cbe6c..346083205 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_xbdBlkDev.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_xbdBlkDev.h @@ -42,4 +42,4 @@ typedef int OCS_device_t; extern OCS_device_t OCS_xbdBlkDevCreateSync(OCS_BLK_DEV *bd, const char *name); extern OCS_STATUS OCS_xbdBlkDevDelete(OCS_device_t dev, OCS_BLK_DEV **ppbd); -#endif /* OCS_XBDBLKDEV_H */ +#endif /* OCS_XBDBLKDEV_H */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_xbdRamDisk.h b/src/unit-test-coverage/ut-stubs/inc/OCS_xbdRamDisk.h index 4ef1f945f..ac2fec4df 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_xbdRamDisk.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_xbdRamDisk.h @@ -37,4 +37,4 @@ /* prototypes normally declared in xbdRamDisk.h */ /* ----------------------------------------- */ -#endif /* OCS_XBDRAMDISK_H */ +#endif /* OCS_XBDRAMDISK_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/arpa/inet.h b/src/unit-test-coverage/ut-stubs/override_inc/arpa/inet.h index 74b0c48d0..b2a1af6b7 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/arpa/inet.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/arpa/inet.h @@ -30,4 +30,4 @@ #define inet_ntop OCS_inet_ntop #define inet_pton OCS_inet_pton -#endif /* OSAL_OVERRIDE_ARPA_INET_H */ +#endif /* OSAL_OVERRIDE_ARPA_INET_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/assert.h b/src/unit-test-coverage/ut-stubs/override_inc/assert.h index 6999e07ec..7e606c698 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/assert.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/assert.h @@ -30,4 +30,4 @@ #define assert OCS_assert -#endif /* OSAL_OVERRIDE_ASSERT_H */ +#endif /* OSAL_OVERRIDE_ASSERT_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/blkIo.h b/src/unit-test-coverage/ut-stubs/override_inc/blkIo.h index 3667b3f13..c367eb5e6 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/blkIo.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/blkIo.h @@ -32,4 +32,4 @@ #define BLK_DEV OCS_BLK_DEV #define BLK_DEV_ID OCS_BLK_DEV_ID -#endif /* OSAL_OVERRIDE_BLKIO_H */ +#endif /* OSAL_OVERRIDE_BLKIO_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/bsp-impl.h b/src/unit-test-coverage/ut-stubs/override_inc/bsp-impl.h index 3e4c5cebb..1bde70096 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/bsp-impl.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/bsp-impl.h @@ -43,4 +43,4 @@ END bsp-impl.h *********************/ -#endif /* BSP_IMPL_H */ +#endif /* BSP_IMPL_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/cbioLib.h b/src/unit-test-coverage/ut-stubs/override_inc/cbioLib.h index d970c13d4..1d2456dd3 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/cbioLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/cbioLib.h @@ -28,4 +28,4 @@ /* mappings for declarations in cbioLib.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_CBIOLIB_H */ +#endif /* OSAL_OVERRIDE_CBIOLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/complex.h b/src/unit-test-coverage/ut-stubs/override_inc/complex.h index 48c6b9cd1..18fe48ec8 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/complex.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/complex.h @@ -28,4 +28,4 @@ /* mappings for declarations in complex.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_COMPLEX_H */ +#endif /* OSAL_OVERRIDE_COMPLEX_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/ctype.h b/src/unit-test-coverage/ut-stubs/override_inc/ctype.h index b3d66aead..bc20c62fc 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/ctype.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/ctype.h @@ -30,4 +30,4 @@ #define isgraph OCS_isgraph -#endif /* OSAL_OVERRIDE_CTYPE_H */ +#endif /* OSAL_OVERRIDE_CTYPE_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/dirent.h b/src/unit-test-coverage/ut-stubs/override_inc/dirent.h index b29378369..4b1de1b47 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/dirent.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/dirent.h @@ -35,4 +35,4 @@ #define readdir OCS_readdir #define rewinddir OCS_rewinddir -#endif /* OSAL_OVERRIDE_DIRENT_H */ +#endif /* OSAL_OVERRIDE_DIRENT_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/dlfcn.h b/src/unit-test-coverage/ut-stubs/override_inc/dlfcn.h index b5cd80ebd..20cccc404 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/dlfcn.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/dlfcn.h @@ -33,4 +33,4 @@ #define dlopen OCS_dlopen #define dlsym OCS_dlsym -#endif /* OSAL_OVERRIDE_DLFCN_H */ +#endif /* OSAL_OVERRIDE_DLFCN_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/dosFsLib.h b/src/unit-test-coverage/ut-stubs/override_inc/dosFsLib.h index 46772ffa7..503da1d14 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/dosFsLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/dosFsLib.h @@ -36,4 +36,4 @@ #define dosFsVolFormat OCS_dosFsVolFormat -#endif /* OSAL_OVERRIDE_DOSFSLIB_H */ +#endif /* OSAL_OVERRIDE_DOSFSLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/drv/hdisk/ataDrv.h b/src/unit-test-coverage/ut-stubs/override_inc/drv/hdisk/ataDrv.h index 1b9d9f659..325551d07 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/drv/hdisk/ataDrv.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/drv/hdisk/ataDrv.h @@ -31,4 +31,4 @@ /* ----------------------------------------- */ #define ataDevCreate OCS_ataDevCreate -#endif /* OSAL_OVERRIDE_DRV_HDISK_ATADRV_H */ +#endif /* OSAL_OVERRIDE_DRV_HDISK_ATADRV_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/errno.h b/src/unit-test-coverage/ut-stubs/override_inc/errno.h index 91ff72ad6..80ccf685e 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/errno.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/errno.h @@ -40,4 +40,4 @@ #define errno OCS_errno -#endif /* OSAL_OVERRIDE_ERRNO_H */ +#endif /* OSAL_OVERRIDE_ERRNO_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/errnoLib.h b/src/unit-test-coverage/ut-stubs/override_inc/errnoLib.h index 0616fce77..a8589b83c 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/errnoLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/errnoLib.h @@ -30,4 +30,4 @@ /* ----------------------------------------- */ #define errnoGet OCS_errnoGet -#endif /* OSAL_OVERRIDE_ERRNOLIB_H */ +#endif /* OSAL_OVERRIDE_ERRNOLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/fcntl.h b/src/unit-test-coverage/ut-stubs/override_inc/fcntl.h index 50b359062..35cc45daa 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/fcntl.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/fcntl.h @@ -56,4 +56,4 @@ #define fcntl OCS_fcntl #define open OCS_open -#endif /* OSAL_OVERRIDE_FCNTL_H */ +#endif /* OSAL_OVERRIDE_FCNTL_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/fenv.h b/src/unit-test-coverage/ut-stubs/override_inc/fenv.h index 0f57e4ac3..8573a3de7 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/fenv.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/fenv.h @@ -28,4 +28,4 @@ /* mappings for declarations in fenv.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_FENV_H */ +#endif /* OSAL_OVERRIDE_FENV_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/float.h b/src/unit-test-coverage/ut-stubs/override_inc/float.h index 17cbacb5f..cc993a971 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/float.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/float.h @@ -28,4 +28,4 @@ /* mappings for declarations in float.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_FLOAT_H */ +#endif /* OSAL_OVERRIDE_FLOAT_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/hostLib.h b/src/unit-test-coverage/ut-stubs/override_inc/hostLib.h index c1597bee9..2719ea193 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/hostLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/hostLib.h @@ -37,4 +37,4 @@ /* ----------------------------------------- */ #define hostGetByName OCS_hostGetByName -#endif /* HOSTLIB_H */ +#endif /* HOSTLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/intLib.h b/src/unit-test-coverage/ut-stubs/override_inc/intLib.h index ad7b71d30..ed9669c40 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/intLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/intLib.h @@ -36,4 +36,4 @@ #define intUnlock OCS_intUnlock #define INUM_TO_IVEC OCS_INUM_TO_IVEC -#endif /* OSAL_OVERRIDE_INTLIB_H */ +#endif /* OSAL_OVERRIDE_INTLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/inttypes.h b/src/unit-test-coverage/ut-stubs/override_inc/inttypes.h index 16ea9a0de..a973d6244 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/inttypes.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/inttypes.h @@ -28,4 +28,4 @@ /* mappings for declarations in inttypes.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_INTTYPES_H */ +#endif /* OSAL_OVERRIDE_INTTYPES_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/ioLib.h b/src/unit-test-coverage/ut-stubs/override_inc/ioLib.h index 9057af7b2..f8006ed59 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/ioLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/ioLib.h @@ -33,4 +33,4 @@ #define FIOUNMOUNT OCS_FIOUNMOUNT #define ioctl OCS_ioctl -#endif /* OSAL_OVERRIDE_IOLIB_H */ +#endif /* OSAL_OVERRIDE_IOLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/iv.h b/src/unit-test-coverage/ut-stubs/override_inc/iv.h index 6d7070fda..760755c9c 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/iv.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/iv.h @@ -28,4 +28,4 @@ /* mappings for declarations in iv.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_IV_H */ +#endif /* OSAL_OVERRIDE_IV_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/loadLib.h b/src/unit-test-coverage/ut-stubs/override_inc/loadLib.h index bb6503866..d45867fa5 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/loadLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/loadLib.h @@ -32,4 +32,4 @@ #define loadModule OCS_loadModule -#endif /* OSAL_OVERRIDE_LOADLIB_H */ +#endif /* OSAL_OVERRIDE_LOADLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/locale.h b/src/unit-test-coverage/ut-stubs/override_inc/locale.h index 4b23b4361..07b96a1fc 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/locale.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/locale.h @@ -28,4 +28,4 @@ /* mappings for declarations in locale.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_LOCALE_H */ +#endif /* OSAL_OVERRIDE_LOCALE_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/logLib.h b/src/unit-test-coverage/ut-stubs/override_inc/logLib.h index d746d7117..a58c2b2a0 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/logLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/logLib.h @@ -29,4 +29,4 @@ /* mappings for declarations in logLib.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_LOGLIB_H */ +#endif /* OSAL_OVERRIDE_LOGLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/math.h b/src/unit-test-coverage/ut-stubs/override_inc/math.h index cc3845973..ff67798ea 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/math.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/math.h @@ -28,4 +28,4 @@ /* mappings for declarations in math.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_MATH_H */ +#endif /* OSAL_OVERRIDE_MATH_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/memPartLib.h b/src/unit-test-coverage/ut-stubs/override_inc/memPartLib.h index 37e46b4b1..d66695b40 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/memPartLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/memPartLib.h @@ -35,4 +35,4 @@ #define memPartInfoGet OCS_memPartInfoGet #define memSysPartId OCS_memSysPartId -#endif /* OSAL_OVERRIDE_MEMPARTLIB_H */ +#endif /* OSAL_OVERRIDE_MEMPARTLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/moduleLib.h b/src/unit-test-coverage/ut-stubs/override_inc/moduleLib.h index 9e8d949de..e15586153 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/moduleLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/moduleLib.h @@ -34,4 +34,4 @@ #define moduleInfoGet OCS_moduleInfoGet -#endif /* OSAL_OVERRIDE_MODULELIB_H */ +#endif /* OSAL_OVERRIDE_MODULELIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/mqueue.h b/src/unit-test-coverage/ut-stubs/override_inc/mqueue.h index 14613166c..5bd35d613 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/mqueue.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/mqueue.h @@ -39,4 +39,4 @@ #define mq_timedsend OCS_mq_timedsend #define mq_unlink OCS_mq_unlink -#endif /* OSAL_OVERRIDE_MQUEUE_H */ +#endif /* OSAL_OVERRIDE_MQUEUE_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/msgQLib.h b/src/unit-test-coverage/ut-stubs/override_inc/msgQLib.h index 41050a5b9..8a5ba72d5 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/msgQLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/msgQLib.h @@ -42,4 +42,4 @@ #define msgQReceive OCS_msgQReceive #define msgQSend OCS_msgQSend -#endif /* OSAL_OVERRIDE_MSGQLIB_H */ +#endif /* OSAL_OVERRIDE_MSGQLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/net/if.h b/src/unit-test-coverage/ut-stubs/override_inc/net/if.h index 04bdc16c3..e3a1c48a2 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/net/if.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/net/if.h @@ -28,4 +28,4 @@ /* mappings for declarations in net/if.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_NET_IF_H */ +#endif /* OSAL_OVERRIDE_NET_IF_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/netdb.h b/src/unit-test-coverage/ut-stubs/override_inc/netdb.h index 44385a8b0..fe5425609 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/netdb.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/netdb.h @@ -28,4 +28,4 @@ /* mappings for declarations in netdb.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_NETDB_H */ +#endif /* OSAL_OVERRIDE_NETDB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/netinet/in.h b/src/unit-test-coverage/ut-stubs/override_inc/netinet/in.h index 093738874..eb885172c 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/netinet/in.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/netinet/in.h @@ -33,4 +33,4 @@ #define htonl OCS_htonl #define ntohl OCS_ntohl -#endif /* OSAL_OVERRIDE_NETINET_IN_H */ +#endif /* OSAL_OVERRIDE_NETINET_IN_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/netinet/tcp.h b/src/unit-test-coverage/ut-stubs/override_inc/netinet/tcp.h index 2509afc0e..a0269e6de 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/netinet/tcp.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/netinet/tcp.h @@ -28,4 +28,4 @@ /* mappings for declarations in netinet/tcp.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_NETINET_TCP_H */ +#endif /* OSAL_OVERRIDE_NETINET_TCP_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/objLib.h b/src/unit-test-coverage/ut-stubs/override_inc/objLib.h index 12dc589b5..54496069a 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/objLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/objLib.h @@ -36,4 +36,4 @@ #define S_objLib_OBJ_TIMEOUT OCS_S_objLib_OBJ_TIMEOUT #define S_objLib_OBJ_NO_METHOD OCS_S_objLib_OBJ_NO_METHOD -#endif /* OSAL_OVERRIDE_OBJLIB_H */ +#endif /* OSAL_OVERRIDE_OBJLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/poll.h b/src/unit-test-coverage/ut-stubs/override_inc/poll.h index 205e1f9a0..adaae476c 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/poll.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/poll.h @@ -28,4 +28,4 @@ /* mappings for declarations in poll.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_POLL_H */ +#endif /* OSAL_OVERRIDE_POLL_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/pthread.h b/src/unit-test-coverage/ut-stubs/override_inc/pthread.h index 858ef5b5a..3a061f2d4 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/pthread.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/pthread.h @@ -76,4 +76,4 @@ #define pthread_setspecific OCS_pthread_setspecific #define pthread_sigmask OCS_pthread_sigmask -#endif /* OSAL_OVERRIDE_PTHREAD_H */ +#endif /* OSAL_OVERRIDE_PTHREAD_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/ramDiskCbio.h b/src/unit-test-coverage/ut-stubs/override_inc/ramDiskCbio.h index 09b138a2d..1c925fc43 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/ramDiskCbio.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/ramDiskCbio.h @@ -29,4 +29,4 @@ /* mappings for declarations in ramDiskCbio.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_RAMDISKCBIO_H */ +#endif /* OSAL_OVERRIDE_RAMDISKCBIO_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/ramDrv.h b/src/unit-test-coverage/ut-stubs/override_inc/ramDrv.h index 892e2212c..97896710c 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/ramDrv.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/ramDrv.h @@ -32,4 +32,4 @@ #define ramDevCreate OCS_ramDevCreate -#endif /* OSAL_OVERRIDE_RAMDRV_H */ +#endif /* OSAL_OVERRIDE_RAMDRV_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/sched.h b/src/unit-test-coverage/ut-stubs/override_inc/sched.h index f9cb17c56..53f6484a3 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/sched.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/sched.h @@ -36,4 +36,4 @@ #define sched_get_priority_max OCS_sched_get_priority_max #define sched_get_priority_min OCS_sched_get_priority_min -#endif /* OSAL_OVERRIDE_SCHED_H */ +#endif /* OSAL_OVERRIDE_SCHED_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/selectLib.h b/src/unit-test-coverage/ut-stubs/override_inc/selectLib.h index efe8f9b57..d43a2a58b 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/selectLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/selectLib.h @@ -35,4 +35,4 @@ /* mappings for declarations in selectLib.h */ /* ----------------------------------------- */ -#endif /* SELECTLIB_H */ +#endif /* SELECTLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/semLib.h b/src/unit-test-coverage/ut-stubs/override_inc/semLib.h index 33b7a81e6..d73febc05 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/semLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/semLib.h @@ -54,4 +54,4 @@ #define semTake OCS_semTake #define semGive OCS_semGive -#endif /* OSAL_OVERRIDE_SEMLIB_H */ +#endif /* OSAL_OVERRIDE_SEMLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/semaphore.h b/src/unit-test-coverage/ut-stubs/override_inc/semaphore.h index 4821f5a63..845434983 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/semaphore.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/semaphore.h @@ -36,4 +36,4 @@ #define sem_timedwait OCS_sem_timedwait #define sem_wait OCS_sem_wait -#endif /* OSAL_OVERRIDE_SEMAPHORE_H */ +#endif /* OSAL_OVERRIDE_SEMAPHORE_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/setjmp.h b/src/unit-test-coverage/ut-stubs/override_inc/setjmp.h index 614e0158a..61d82bc1f 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/setjmp.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/setjmp.h @@ -28,4 +28,4 @@ /* mappings for declarations in setjmp.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_SETJMP_H */ +#endif /* OSAL_OVERRIDE_SETJMP_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/shellLib.h b/src/unit-test-coverage/ut-stubs/override_inc/shellLib.h index 07fe614ee..ce6e4d61c 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/shellLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/shellLib.h @@ -30,4 +30,4 @@ /* ----------------------------------------- */ #define shellGenericInit OCS_shellGenericInit -#endif /* OSAL_OVERRIDE_SHELLLIB_H */ +#endif /* OSAL_OVERRIDE_SHELLLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/signal.h b/src/unit-test-coverage/ut-stubs/override_inc/signal.h index ae34e7973..ec1b31caf 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/signal.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/signal.h @@ -56,4 +56,4 @@ #define sigsuspend OCS_sigsuspend #define sigwait OCS_sigwait -#endif /* OSAL_OVERRIDE_SIGNAL_H */ +#endif /* OSAL_OVERRIDE_SIGNAL_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/stat.h b/src/unit-test-coverage/ut-stubs/override_inc/stat.h index 250dfd2b6..e0cabeafd 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/stat.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/stat.h @@ -40,4 +40,4 @@ #define statvfs OCS_statvfs #define statfs OCS_statvfs -#endif /* OSAL_OVERRIDE_STAT_H */ +#endif /* OSAL_OVERRIDE_STAT_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/stdarg.h b/src/unit-test-coverage/ut-stubs/override_inc/stdarg.h index bff62d729..187c73683 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/stdarg.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/stdarg.h @@ -32,4 +32,4 @@ #define va_start(ap, last) OCS_va_start(ap, last) #define va_end(ap) OCS_va_end(ap) -#endif /* OSAL_OVERRIDE_STDARG_H */ +#endif /* OSAL_OVERRIDE_STDARG_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/stdio.h b/src/unit-test-coverage/ut-stubs/override_inc/stdio.h index 659f7056f..e09a93696 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/stdio.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/stdio.h @@ -45,4 +45,4 @@ #define stdout OCS_stdout #define stderr OCS_stderr -#endif /* OSAL_OVERRIDE_STDIO_H */ +#endif /* OSAL_OVERRIDE_STDIO_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/stdlib.h b/src/unit-test-coverage/ut-stubs/override_inc/stdlib.h index bf1d54f40..9ea6f219b 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/stdlib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/stdlib.h @@ -37,4 +37,4 @@ #define malloc OCS_malloc #define free OCS_free -#endif /* OSAL_OVERRIDE_STDLIB_H */ +#endif /* OSAL_OVERRIDE_STDLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/string.h b/src/unit-test-coverage/ut-stubs/override_inc/string.h index b5d14fcbb..e4b83f152 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/string.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/string.h @@ -41,4 +41,4 @@ #define strncat OCS_strncat #define strerror OCS_strerror -#endif /* OSAL_OVERRIDE_STRING_H */ +#endif /* OSAL_OVERRIDE_STRING_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/strings.h b/src/unit-test-coverage/ut-stubs/override_inc/strings.h index 226344f2d..1d7142f31 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/strings.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/strings.h @@ -28,4 +28,4 @@ /* mappings for declarations in strings.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_STRINGS_H */ +#endif /* OSAL_OVERRIDE_STRINGS_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/symLib.h b/src/unit-test-coverage/ut-stubs/override_inc/symLib.h index 66ede2c2e..1adcd6adf 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/symLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/symLib.h @@ -51,4 +51,4 @@ #define symEach OCS_symEach #define symFind OCS_symFind -#endif /* SYMLIB_H */ +#endif /* SYMLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/sys/ioctl.h b/src/unit-test-coverage/ut-stubs/override_inc/sys/ioctl.h index e510b4c15..8038d86b4 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/sys/ioctl.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/sys/ioctl.h @@ -30,4 +30,4 @@ #define ioctl OCS_ioctl -#endif /* OSAL_OVERRIDE_SYS_IOCTL_H */ +#endif /* OSAL_OVERRIDE_SYS_IOCTL_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/sys/ipc.h b/src/unit-test-coverage/ut-stubs/override_inc/sys/ipc.h index e94760c2d..7d99f3b4c 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/sys/ipc.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/sys/ipc.h @@ -28,4 +28,4 @@ /* mappings for declarations in sys/ipc.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_SYS_IPC_H */ +#endif /* OSAL_OVERRIDE_SYS_IPC_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/sys/mman.h b/src/unit-test-coverage/ut-stubs/override_inc/sys/mman.h index f4d9e40bb..ef3c670f8 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/sys/mman.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/sys/mman.h @@ -38,4 +38,4 @@ #define mmap OCS_mmap #define munmap OCS_munmap -#endif /* OSAL_OVERRIDE_SYS_MMAN_H */ +#endif /* OSAL_OVERRIDE_SYS_MMAN_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/sys/select.h b/src/unit-test-coverage/ut-stubs/override_inc/sys/select.h index 8f7809ef1..4a2ddb46f 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/sys/select.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/sys/select.h @@ -50,4 +50,4 @@ #define FD_CLR OCS_FD_CLR #define FD_ZERO OCS_FD_ZERO -#endif /* SELECT_H */ +#endif /* SELECT_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/sys/signal.h b/src/unit-test-coverage/ut-stubs/override_inc/sys/signal.h index d2014f1f9..0304c264e 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/sys/signal.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/sys/signal.h @@ -25,4 +25,4 @@ /* alias to signal.h */ #include -#endif /* OSAL_OVERRIDE_SYS_SIGNAL_H */ +#endif /* OSAL_OVERRIDE_SYS_SIGNAL_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/sys/socket.h b/src/unit-test-coverage/ut-stubs/override_inc/sys/socket.h index 50c5bf346..11128a920 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/sys/socket.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/sys/socket.h @@ -39,4 +39,4 @@ #define setsockopt OCS_setsockopt #define socket OCS_socket -#endif /* OSAL_OVERRIDE_SYS_SOCKET_H */ +#endif /* OSAL_OVERRIDE_SYS_SOCKET_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/sys/stat.h b/src/unit-test-coverage/ut-stubs/override_inc/sys/stat.h index 575ad693a..b6f5d80ce 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/sys/stat.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/sys/stat.h @@ -25,4 +25,4 @@ /* alias to stat.h */ #include -#endif /* OSAL_OVERRIDE_SYS_STAT_H */ +#endif /* OSAL_OVERRIDE_SYS_STAT_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/sys/statvfs.h b/src/unit-test-coverage/ut-stubs/override_inc/sys/statvfs.h index a024f1700..7d53a30e2 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/sys/statvfs.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/sys/statvfs.h @@ -25,4 +25,4 @@ /* alias to stat.h */ #include -#endif /* OSAL_OVERRIDE_SYS_STATVFS_H */ +#endif /* OSAL_OVERRIDE_SYS_STATVFS_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/sys/time.h b/src/unit-test-coverage/ut-stubs/override_inc/sys/time.h index 5c25ab547..111336de4 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/sys/time.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/sys/time.h @@ -29,4 +29,4 @@ /* mappings for declarations in sys/time.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_SYS_TIME_H */ +#endif /* OSAL_OVERRIDE_SYS_TIME_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/sys/times.h b/src/unit-test-coverage/ut-stubs/override_inc/sys/times.h index fe9f01c68..052399273 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/sys/times.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/sys/times.h @@ -29,4 +29,4 @@ /* mappings for declarations in sys/times.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_SYS_TIMES_H */ +#endif /* OSAL_OVERRIDE_SYS_TIMES_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/sys/types.h b/src/unit-test-coverage/ut-stubs/override_inc/sys/types.h index a6e83d510..c1cd599f8 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/sys/types.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/sys/types.h @@ -34,4 +34,4 @@ #define gid_t OCS_gid_t #define uid_t OCS_uid_t -#endif /* OSAL_OVERRIDE_SYS_TYPES_H */ +#endif /* OSAL_OVERRIDE_SYS_TYPES_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/sys/un.h b/src/unit-test-coverage/ut-stubs/override_inc/sys/un.h index 57540467e..9addd5013 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/sys/un.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/sys/un.h @@ -28,4 +28,4 @@ /* mappings for declarations in sys/un.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_SYS_UN_H */ +#endif /* OSAL_OVERRIDE_SYS_UN_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/sys/wait.h b/src/unit-test-coverage/ut-stubs/override_inc/sys/wait.h index 497834d24..1d410f5e3 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/sys/wait.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/sys/wait.h @@ -28,4 +28,4 @@ /* mappings for declarations in sys/wait.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_SYS_WAIT_H */ +#endif /* OSAL_OVERRIDE_SYS_WAIT_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/sysLib.h b/src/unit-test-coverage/ut-stubs/override_inc/sysLib.h index b26213cc7..145041eb7 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/sysLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/sysLib.h @@ -30,4 +30,4 @@ /* ----------------------------------------- */ #define sysClkRateGet OCS_sysClkRateGet -#endif /* OSAL_OVERRIDE_SYSLIB_H */ +#endif /* OSAL_OVERRIDE_SYSLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/taskLib.h b/src/unit-test-coverage/ut-stubs/override_inc/taskLib.h index dcf88983f..0b939ea80 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/taskLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/taskLib.h @@ -53,4 +53,4 @@ #define taskInit OCS_taskInit #define taskTcb OCS_taskTcb -#endif /* OSAL_OVERRIDE_TASKLIB_H */ +#endif /* OSAL_OVERRIDE_TASKLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/taskVarLib.h b/src/unit-test-coverage/ut-stubs/override_inc/taskVarLib.h index 1e89cb3b3..46f3f7a4a 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/taskVarLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/taskVarLib.h @@ -31,4 +31,4 @@ #define taskVarAdd OCS_taskVarAdd -#endif /* OSAL_OVERRIDE_TASKVARLIB_H */ +#endif /* OSAL_OVERRIDE_TASKVARLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/termios.h b/src/unit-test-coverage/ut-stubs/override_inc/termios.h index 8713f77a0..ab4887d2c 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/termios.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/termios.h @@ -28,4 +28,4 @@ /* mappings for declarations in termios.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_TERMIOS_H */ +#endif /* OSAL_OVERRIDE_TERMIOS_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/tgmath.h b/src/unit-test-coverage/ut-stubs/override_inc/tgmath.h index 419f4118c..87bd41129 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/tgmath.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/tgmath.h @@ -28,4 +28,4 @@ /* mappings for declarations in tgmath.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_TGMATH_H */ +#endif /* OSAL_OVERRIDE_TGMATH_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/time.h b/src/unit-test-coverage/ut-stubs/override_inc/time.h index d5d4cd298..9cfcbe605 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/time.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/time.h @@ -51,4 +51,4 @@ #define timer_settime OCS_timer_settime #define timer_connect OCS_timer_connect -#endif /* OSAL_OVERRIDE_TIME_H */ +#endif /* OSAL_OVERRIDE_TIME_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/timers.h b/src/unit-test-coverage/ut-stubs/override_inc/timers.h index 843fcdbff..b6c6012ae 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/timers.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/timers.h @@ -29,4 +29,4 @@ * Note: this is just an alias for time.h */ -#endif /* OSAL_OVERRIDE_TIMERS_H */ +#endif /* OSAL_OVERRIDE_TIMERS_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/ulimit.h b/src/unit-test-coverage/ut-stubs/override_inc/ulimit.h index 93d0c4039..c1d9c6768 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/ulimit.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/ulimit.h @@ -29,4 +29,4 @@ /* ----------------------------------------- */ #define ulimit OCS_ulimit -#endif /* OSAL_OVERRIDE_ULIMIT_H */ +#endif /* OSAL_OVERRIDE_ULIMIT_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/unistd.h b/src/unit-test-coverage/ut-stubs/override_inc/unistd.h index a4c334d25..31d3afeb6 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/unistd.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/unistd.h @@ -47,4 +47,4 @@ #define sysconf OCS_sysconf #define write OCS_write -#endif /* OSAL_OVERRIDE_UNISTD_H */ +#endif /* OSAL_OVERRIDE_UNISTD_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/unldLib.h b/src/unit-test-coverage/ut-stubs/override_inc/unldLib.h index 29a5f4546..5076192cf 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/unldLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/unldLib.h @@ -31,4 +31,4 @@ /* ----------------------------------------- */ #define unldByModuleId OCS_unldByModuleId -#endif /* OSAL_OVERRIDE_UNLDLIB_H */ +#endif /* OSAL_OVERRIDE_UNLDLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/usrLib.h b/src/unit-test-coverage/ut-stubs/override_inc/usrLib.h index 3ff95193c..21f4b9104 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/usrLib.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/usrLib.h @@ -29,4 +29,4 @@ /* mappings for declarations in usrLib.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_USRLIB_H */ +#endif /* OSAL_OVERRIDE_USRLIB_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/version.h b/src/unit-test-coverage/ut-stubs/override_inc/version.h index f9c4cc62f..4ccf55a6c 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/version.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/version.h @@ -28,4 +28,4 @@ /* mappings for declarations in version.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_VERSION_H */ +#endif /* OSAL_OVERRIDE_VERSION_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/vxWorks.h b/src/unit-test-coverage/ut-stubs/override_inc/vxWorks.h index 2fd8fe4f3..0f36e6510 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/vxWorks.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/vxWorks.h @@ -53,4 +53,4 @@ #define _Vx_usr_arg_t OCS_Vx_usr_arg_t -#endif /* VXWORKS_H */ +#endif /* VXWORKS_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/wchar.h b/src/unit-test-coverage/ut-stubs/override_inc/wchar.h index 253f6b37e..9f0d251eb 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/wchar.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/wchar.h @@ -28,4 +28,4 @@ /* mappings for declarations in wchar.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_WCHAR_H */ +#endif /* OSAL_OVERRIDE_WCHAR_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/wctype.h b/src/unit-test-coverage/ut-stubs/override_inc/wctype.h index 5718491ec..abcec3509 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/wctype.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/wctype.h @@ -28,4 +28,4 @@ /* mappings for declarations in wctype.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_WCTYPE_H */ +#endif /* OSAL_OVERRIDE_WCTYPE_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/xbdBlkDev.h b/src/unit-test-coverage/ut-stubs/override_inc/xbdBlkDev.h index 4f8d7ca3b..39bba2a37 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/xbdBlkDev.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/xbdBlkDev.h @@ -35,4 +35,4 @@ #define xbdBlkDevCreateSync OCS_xbdBlkDevCreateSync #define xbdBlkDevDelete OCS_xbdBlkDevDelete -#endif /* OSAL_OVERRIDE_XBDBLKDEV_H */ +#endif /* OSAL_OVERRIDE_XBDBLKDEV_H */ diff --git a/src/unit-test-coverage/ut-stubs/override_inc/xbdRamDisk.h b/src/unit-test-coverage/ut-stubs/override_inc/xbdRamDisk.h index f5e282797..9344b0294 100644 --- a/src/unit-test-coverage/ut-stubs/override_inc/xbdRamDisk.h +++ b/src/unit-test-coverage/ut-stubs/override_inc/xbdRamDisk.h @@ -29,4 +29,4 @@ /* mappings for declarations in xbdRamDisk.h */ /* ----------------------------------------- */ -#endif /* OSAL_OVERRIDE_XBDRAMDISK_H */ +#endif /* OSAL_OVERRIDE_XBDRAMDISK_H */ diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-loader-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-loader-impl-stubs.c index 7c2b2ccc5..fedb8593b 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-loader-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-loader-impl-stubs.c @@ -40,5 +40,6 @@ UT_DEFAULT_STUB(OS_ModuleLoad_Impl, (const OS_object_token_t *token, const char UT_DEFAULT_STUB(OS_ModuleUnload_Impl, (const OS_object_token_t *token)) UT_DEFAULT_STUB(OS_ModuleGetInfo_Impl, (const OS_object_token_t *token, OS_module_prop_t *module_prop)) UT_DEFAULT_STUB(OS_GlobalSymbolLookup_Impl, (cpuaddr * SymbolAddress, const char *SymbolName)) -UT_DEFAULT_STUB(OS_ModuleSymbolLookup_Impl, (const OS_object_token_t *token, cpuaddr *SymbolAddress, const char *SymbolName)) +UT_DEFAULT_STUB(OS_ModuleSymbolLookup_Impl, + (const OS_object_token_t *token, cpuaddr *SymbolAddress, const char *SymbolName)) UT_DEFAULT_STUB(OS_SymbolTableDump_Impl, (const char *filename, size_t size_limit)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-queue-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-queue-impl-stubs.c index d3eea368a..238a8831f 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-queue-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-queue-impl-stubs.c @@ -40,6 +40,7 @@ UT_DEFAULT_STUB(OS_QueueCreate_Impl, (const OS_object_token_t *token, uint32 flags)) UT_DEFAULT_STUB(OS_QueueDelete_Impl, (const OS_object_token_t *token)) -UT_DEFAULT_STUB(OS_QueueGet_Impl, (const OS_object_token_t *token, void *data, size_t size, size_t *size_copied, int32 timeout)) +UT_DEFAULT_STUB(OS_QueueGet_Impl, + (const OS_object_token_t *token, void *data, size_t size, size_t *size_copied, int32 timeout)) UT_DEFAULT_STUB(OS_QueuePut_Impl, (const OS_object_token_t *token, const void *data, size_t size, uint32 flags)) UT_DEFAULT_STUB(OS_QueueGetInfo_Impl, (const OS_object_token_t *token, OS_queue_prop_t *queue_prop)) diff --git a/src/unit-test-coverage/ut-stubs/src/posix-dlfcn-stubs.c b/src/unit-test-coverage/ut-stubs/src/posix-dlfcn-stubs.c index 5f93bddfb..a97a164c9 100644 --- a/src/unit-test-coverage/ut-stubs/src/posix-dlfcn-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/posix-dlfcn-stubs.c @@ -39,4 +39,4 @@ extern char *OCS_dlerror(void); extern void *OCS_dlopen(const char *file, int mode); extern void *OCS_dlsym(void *handle, const char *name); -#endif /* OCS_DLFCN_H */ +#endif /* OCS_DLFCN_H */ diff --git a/src/unit-test-coverage/ut-stubs/src/vxworks-intLib-stubs.c b/src/unit-test-coverage/ut-stubs/src/vxworks-intLib-stubs.c index 61499b1a3..ff3d15fde 100644 --- a/src/unit-test-coverage/ut-stubs/src/vxworks-intLib-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/vxworks-intLib-stubs.c @@ -50,10 +50,10 @@ static void OCS_intLib_dummyfunc(void) {} OCS_VOIDFUNCPTR *OCS_INUM_TO_IVEC(unsigned int ui) { - int32 Status = UT_DEFAULT_IMPL(OCS_INUM_TO_IVEC); - OCS_VOIDFUNCPTR *VecTbl; - OCS_VOIDFUNCPTR DummyVec; - size_t VecTblSize; + int32 Status = UT_DEFAULT_IMPL(OCS_INUM_TO_IVEC); + OCS_VOIDFUNCPTR * VecTbl; + static OCS_VOIDFUNCPTR DummyVec; + size_t VecTblSize; if (Status == 0) { diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-binsem.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-binsem.h index 7975d296b..3e33db446 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-binsem.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-binsem.h @@ -48,4 +48,4 @@ extern const UT_EntryKey_t UT_StubKey_GenericSemGive; extern int32 UT_Call_OS_VxWorks_BinSemAPI_Impl_Init(void); -#endif /* UT_ADAPTOR_BINSEM_H */ +#endif /* UT_ADAPTOR_BINSEM_H */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-common.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-common.h index c1c7b645d..75dd24a0a 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-common.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-common.h @@ -55,4 +55,4 @@ extern int32 OS_VxWorks_GenericSemGive(OCS_SEM_ID vxid); */ extern const UT_EntryKey_t UT_StubKey_OS_VxWorks_TableMutex_Init; -#endif /* UT_ADAPTOR_COMMON_H */ +#endif /* UT_ADAPTOR_COMMON_H */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-console.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-console.h index 835ca465f..2d45fbafb 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-console.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-console.h @@ -44,4 +44,4 @@ extern void UT_ConsoleTest_TaskEntry(int arg); */ extern void UT_ConsoleTest_SetConsoleAsync(osal_index_t local_id, bool is_async); -#endif /* UT_ADAPTOR_CONSOLE_H */ +#endif /* UT_ADAPTOR_CONSOLE_H */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-countsem.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-countsem.h index b074ce878..9e628a9ec 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-countsem.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-countsem.h @@ -46,4 +46,4 @@ extern size_t const UT_Ref_OS_impl_count_sem_table_SIZE; int32 UT_Call_OS_VxWorks_CountSemAPI_Impl_Init(void); -#endif /* UT_ADAPTOR_COUNTSEM_H */ +#endif /* UT_ADAPTOR_COUNTSEM_H */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-dirs.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-dirs.h index 3ffb95cf4..d528b209e 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-dirs.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-dirs.h @@ -44,4 +44,4 @@ */ extern int32 UT_Call_OS_VxWorks_DirAPI_Impl_Init(void); -#endif /* UT_ADAPTOR_DIRS_H */ +#endif /* UT_ADAPTOR_DIRS_H */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-files.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-files.h index 4bc2f7b44..a77d79ce8 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-files.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-files.h @@ -55,4 +55,4 @@ unsigned int UT_FileTest_GetSelfEGID(void); void UT_FileTest_Set_Selectable(osal_index_t local_id, bool is_selectable); -#endif /* UT_ADAPTOR_FILES_H */ +#endif /* UT_ADAPTOR_FILES_H */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-filesys.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-filesys.h index 5f6ec4f51..b82f90ca0 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-filesys.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-filesys.h @@ -36,4 +36,4 @@ extern size_t const UT_Ref_OS_impl_filesys_table_SIZE; void UT_FileSysTest_SetupFileSysEntry(osal_index_t id, OCS_BLK_DEV *blkdev, OCS_device_t xbddev, uint32 MaxParts); -#endif /* UT_ADAPTOR_FILESYS_H */ +#endif /* UT_ADAPTOR_FILESYS_H */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-filetable-stub.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-filetable-stub.h index 4b4e00172..3881fde0e 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-filetable-stub.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-filetable-stub.h @@ -34,4 +34,4 @@ extern void *const UT_FileTableTest_OS_impl_filehandle_table; extern size_t const UT_FileTableTest_OS_impl_filehandle_table_SIZE; -#endif /* UT_ADAPTOR_FILETABLE_STUB_H */ +#endif /* UT_ADAPTOR_FILETABLE_STUB_H */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-idmap.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-idmap.h index b2daaa36a..69117f85e 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-idmap.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-idmap.h @@ -42,4 +42,4 @@ int32 UT_Call_OS_VxWorks_TableMutex_Init(osal_objtype_t idtype); void UT_IdMapTest_SetImplTableMutex(osal_objtype_t idtype, OCS_SEM_ID vxid); -#endif /* UT_ADAPTOR_IDMAP_H */ +#endif /* UT_ADAPTOR_IDMAP_H */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-loader.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-loader.h index 4e04fb3e3..2d5a11827 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-loader.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-loader.h @@ -38,4 +38,4 @@ extern size_t const UT_Ref_OS_impl_module_table_SIZE; extern int32 UT_Call_OS_VxWorks_ModuleAPI_Impl_Init(void); -#endif /* UT_ADAPTOR_LOADER_H */ +#endif /* UT_ADAPTOR_LOADER_H */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-mutex.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-mutex.h index 52485d7a4..a4ed0f0ac 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-mutex.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-mutex.h @@ -46,4 +46,4 @@ extern size_t const UT_Ref_OS_impl_mutex_table_SIZE; int32 UT_Call_OS_VxWorks_MutexAPI_Impl_Init(void); -#endif /* UT_ADAPTOR_MUTEX_H */ +#endif /* UT_ADAPTOR_MUTEX_H */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-queues.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-queues.h index 4e0cd2360..e29935dc5 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-queues.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-queues.h @@ -45,4 +45,4 @@ extern size_t const UT_Ref_OS_impl_queue_table_SIZE; int32 UT_Call_OS_VxWorks_QueueAPI_Impl_Init(void); -#endif /* UT_ADAPTOR_QUEUES_H */ +#endif /* UT_ADAPTOR_QUEUES_H */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-symtab.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-symtab.h index 01d3d86db..9e8f1a32f 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-symtab.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-symtab.h @@ -32,4 +32,4 @@ int32 UT_SymTabTest_CallIteratorFunc(const char *name, void *val, size_t TestSize, size_t SizeLimit); -#endif /* UT_ADAPTOR_SYMTAB_H */ +#endif /* UT_ADAPTOR_SYMTAB_H */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-tasks.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-tasks.h index df8114f4a..68a4894f5 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-tasks.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-tasks.h @@ -48,4 +48,4 @@ void UT_TaskTest_SetImplTaskId(osal_index_t local_id, OCS_TASK_ID TaskI int UT_TaskTest_CallEntryPoint(osal_id_t arg); OCS_WIND_TCB *UT_TaskTest_GetTaskTcb(osal_index_t local_id); -#endif /* UT_ADAPTOR_TASKS_H */ +#endif /* UT_ADAPTOR_TASKS_H */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-timebase.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-timebase.h index 6581b0329..a377dd541 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-timebase.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-timebase.h @@ -62,4 +62,4 @@ bool UT_TimeBaseTest_CheckTimeBaseErrorState(osal_index_t local_id); /* Invoke the internal UsecToTimespec API */ void UT_TimeBaseTest_UsecToTimespec(uint32 usecs, struct OCS_timespec *time_spec); -#endif /* UT_ADAPTOR_TIMEBASE_H */ +#endif /* UT_ADAPTOR_TIMEBASE_H */ diff --git a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-dirtable-stub.c b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-dirtable-stub.c index 766326414..392b5cee0 100644 --- a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-dirtable-stub.c +++ b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-dirtable-stub.c @@ -33,4 +33,3 @@ #include OS_impl_dir_internal_record_t OS_impl_dir_table[OS_MAX_NUM_OPEN_DIRS]; - diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-idmap.c b/src/unit-test-coverage/vxworks/src/coveragetest-idmap.c index f8d7d907c..f593d6148 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-idmap.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-idmap.c @@ -62,7 +62,7 @@ void Test_OS_Unlock_Global_Impl(void) UtAssert_True(UT_GetStubCount(UT_KEY(OCS_semGive)) == 1, "semTake() called"); UT_SetDefaultReturnValue(UT_KEY(OCS_semGive), -1); - OS_Lock_Global_Impl(OS_OBJECT_TYPE_OS_TASK); /* for coverage of error path */ + OS_Unlock_Global_Impl(OS_OBJECT_TYPE_OS_TASK); /* for coverage of error path */ } void Test_OS_API_Impl_Init(void) @@ -78,6 +78,22 @@ void Test_OS_API_Impl_Init(void) OSAPI_TEST_FUNCTION_RC(UT_Call_OS_VxWorks_TableMutex_Init(OS_OBJECT_TYPE_OS_TASK), OS_SUCCESS); } +void Test_OS_WaitForStateChange_Impl(void) +{ + /* + * Test Case For: + * void OS_WaitForStateChange_Impl(osal_objtype_t idtype, uint32 attempts) + */ + + /* + * This has no return value/error results - just needs to be called for coverage. + * Call it once with a low number and once with a high number of attempts - + * which should cause it to hit its limit for wait time. + */ + OS_WaitForStateChange_Impl(OS_OBJECT_TYPE_OS_TASK, 1); + OS_WaitForStateChange_Impl(OS_OBJECT_TYPE_OS_TASK, 1000); +} + /* ------------------- End of test cases --------------------------------------*/ /* Osapi_Test_Setup @@ -108,4 +124,5 @@ void UtTest_Setup(void) ADD_TEST(OS_Lock_Global_Impl); ADD_TEST(OS_Unlock_Global_Impl); ADD_TEST(OS_API_Impl_Init); + ADD_TEST(OS_WaitForStateChange_Impl); } diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c b/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c index a3ab7396b..6bca6074b 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c @@ -69,9 +69,9 @@ void Test_OS_SymTableIterator_Impl(void) OSAPI_TEST_FUNCTION_RC(UT_SymTabTest_CallIteratorFunc("ut", &Data, 100, 1000), true); OSAPI_TEST_FUNCTION_RC(UT_SymTabTest_CallIteratorFunc("ut", &Data, 100, 101), false); - UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), OS_MAX_SYM_LEN + 10); + UT_SetDefaultReturnValue(UT_KEY(OCS_memchr), OS_ERROR); OSAPI_TEST_FUNCTION_RC(UT_SymTabTest_CallIteratorFunc("ut", &Data, 100, 1000), false); - UT_ClearDefaultReturnValue(UT_KEY(OCS_strlen)); + UT_ClearDefaultReturnValue(UT_KEY(OCS_memchr)); UT_SetDefaultReturnValue(UT_KEY(OCS_write), -1); OSAPI_TEST_FUNCTION_RC(UT_SymTabTest_CallIteratorFunc("ut", &Data, 100, 1000), false); UT_ClearDefaultReturnValue(UT_KEY(OCS_write)); diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-tasks.c b/src/unit-test-coverage/vxworks/src/coveragetest-tasks.c index 5b20961e7..8af36a00d 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-tasks.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-tasks.c @@ -132,6 +132,18 @@ void Test_OS_TaskDelete_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_TaskDelete_Impl(&token), OS_ERROR); } +void Test_OS_TaskDetach_Impl(void) +{ + /* + * Test Case For: + * int32 OS_TaskDetach_Impl(const OS_object_token_t *token) + */ + OS_object_token_t token; + + /* no-op on VxWorks - always returns sucess */ + OSAPI_TEST_FUNCTION_RC(OS_TaskDetach_Impl(&token), OS_SUCCESS); +} + void Test_OS_TaskExit_Impl(void) { /* @@ -280,6 +292,7 @@ void UtTest_Setup(void) ADD_TEST(OS_VxWorksEntry); ADD_TEST(OS_TaskMatch_Impl); ADD_TEST(OS_TaskDelete_Impl); + ADD_TEST(OS_TaskDetach_Impl); ADD_TEST(OS_TaskExit_Impl); ADD_TEST(OS_TaskDelay_Impl); ADD_TEST(OS_TaskSetPriority_Impl); diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-timebase.c b/src/unit-test-coverage/vxworks/src/coveragetest-timebase.c index 99e64ca8f..5455ecce4 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-timebase.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-timebase.c @@ -110,9 +110,15 @@ void Test_OS_TimeBaseCreate_Impl(void) * This should be done first as it will assign the "external_sync" * and therefore cause future calls to skip this block. */ - memset(&id, 0x01, sizeof(id)); + id = OS_ObjectIdFromInteger(OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT); + + OS_global_timebase_table[0].active_id = id; + UT_TimeBaseTest_Setup(UT_INDEX_0, OCS_SIGRTMIN, false); + + id = OS_ObjectIdFromInteger(OS_ObjectIdToInteger(id) + 1); + OS_global_timebase_table[1].active_id = id; - UT_TimeBaseTest_Setup(UT_INDEX_1, OCS_SIGRTMIN, false); + UT_TimeBaseTest_Setup(UT_INDEX_1, 1 + OCS_SIGRTMIN, false); UT_SetDefaultReturnValue(UT_KEY(OCS_sigismember), true); OSAPI_TEST_FUNCTION_RC(OS_TimeBaseCreate_Impl(&token), OS_TIMER_ERR_UNAVAILABLE); UT_ResetState(UT_KEY(OCS_sigismember)); @@ -158,6 +164,11 @@ void Test_OS_TimeBaseCreate_Impl(void) UT_SetDefaultReturnValue(UT_KEY(OCS_timer_create), -1); UT_TimeBaseTest_CallRegisterTimer(OS_OBJECT_ID_UNDEFINED); UtAssert_True(UT_TimeBaseTest_CheckTimeBaseErrorState(UT_INDEX_0), "timer registration failure state"); + + UT_TimeBaseTest_ClearTimeBaseRegState(UT_INDEX_1); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERROR); + UT_TimeBaseTest_CallRegisterTimer(OS_OBJECT_ID_UNDEFINED); + UtAssert_True(!UT_TimeBaseTest_CheckTimeBaseRegisteredState(UT_INDEX_0), "timer registration bad ID"); } void Test_OS_VxWorks_SigWait(void) diff --git a/src/unit-test-coverage/vxworks/src/os-vxworks-coveragetest.h b/src/unit-test-coverage/vxworks/src/os-vxworks-coveragetest.h index 334ebe41c..ac41fa602 100644 --- a/src/unit-test-coverage/vxworks/src/os-vxworks-coveragetest.h +++ b/src/unit-test-coverage/vxworks/src/os-vxworks-coveragetest.h @@ -71,4 +71,4 @@ void Osapi_Test_Setup(void); void Osapi_Test_Teardown(void); -#endif /* OS_VXWORKS_COVERAGETEST_H */ +#endif /* OS_VXWORKS_COVERAGETEST_H */ diff --git a/src/unit-tests/inc/ut_os_support.h b/src/unit-tests/inc/ut_os_support.h index ebdf0a974..ff7c9144e 100644 --- a/src/unit-tests/inc/ut_os_support.h +++ b/src/unit-tests/inc/ut_os_support.h @@ -135,7 +135,7 @@ static inline bool UtOsalImplemented(int32 Fn, const char *File, uint32 Line) /*--------------------------------------------------------------------------------*/ -#endif /* UT_OS_SUPPORT_H */ +#endif /* UT_OS_SUPPORT_H */ /*================================================================================* ** End of File: ut_os_support.h diff --git a/src/unit-tests/oscore-test/ut_oscore_binsem_test.h b/src/unit-tests/oscore-test/ut_oscore_binsem_test.h index 6aa311fe0..081a87d3a 100644 --- a/src/unit-tests/oscore-test/ut_oscore_binsem_test.h +++ b/src/unit-tests/oscore-test/ut_oscore_binsem_test.h @@ -64,7 +64,7 @@ void UT_os_bin_sem_get_info_test(void); /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSCORE_BINSEM_TEST_H */ +#endif /* UT_OSCORE_BINSEM_TEST_H */ /*================================================================================* ** End of File: ut_oscore_binsem_test.h diff --git a/src/unit-tests/oscore-test/ut_oscore_countsem_test.h b/src/unit-tests/oscore-test/ut_oscore_countsem_test.h index 71e9d31d6..6cad49f9c 100644 --- a/src/unit-tests/oscore-test/ut_oscore_countsem_test.h +++ b/src/unit-tests/oscore-test/ut_oscore_countsem_test.h @@ -63,7 +63,7 @@ void UT_os_count_sem_get_info_test(void); /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSCORE_COUNTSEM_TEST_H */ +#endif /* UT_OSCORE_COUNTSEM_TEST_H */ /*================================================================================* ** End of File: ut_oscore_countsem_test.h diff --git a/src/unit-tests/oscore-test/ut_oscore_misc_test.c b/src/unit-tests/oscore-test/ut_oscore_misc_test.c index cb0527312..4a33644e9 100644 --- a/src/unit-tests/oscore-test/ut_oscore_misc_test.c +++ b/src/unit-tests/oscore-test/ut_oscore_misc_test.c @@ -291,7 +291,7 @@ void UT_os_getlocaltime_test() { UtPrintf("OS_GetLocalTime() - #3 Nominal "); UtPrintf("[Expecting output after API call to increase over time: %ld.%ld]\n", - (long)OS_TimeGetTotalSeconds(time_struct), (long)OS_TimeGetMicrosecondsPart(time_struct)); + (long)OS_TimeGetTotalSeconds(time_struct), (long)OS_TimeGetMicrosecondsPart(time_struct)); OS_TaskDelay(20); OS_GetLocalTime(&time_struct); @@ -380,7 +380,7 @@ void UT_os_setlocaltime_test() { UtPrintf("OS_SetLocalTime() - #3 Nominal "); UtPrintf("[Expecting output before API call to increase over time: %ld.%ld]\n", - (long)OS_TimeGetTotalSeconds(time_struct), (long)OS_TimeGetMicrosecondsPart(time_struct)); + (long)OS_TimeGetTotalSeconds(time_struct), (long)OS_TimeGetMicrosecondsPart(time_struct)); OS_TaskDelay(20); OS_GetLocalTime(&time_struct); @@ -392,8 +392,8 @@ void UT_os_setlocaltime_test() res = OS_SetLocalTime(&time_struct); if (res == OS_SUCCESS) { - UtPrintf("OS_SetLocalTime() - #3 Nominal [New time set at %ld.%ld]\n", (long)OS_TimeGetTotalSeconds(time_struct), - (long)OS_TimeGetMicrosecondsPart(time_struct)); + UtPrintf("OS_SetLocalTime() - #3 Nominal [New time set at %ld.%ld]\n", + (long)OS_TimeGetTotalSeconds(time_struct), (long)OS_TimeGetMicrosecondsPart(time_struct)); res = OS_GetLocalTime(&time_struct); if (res == OS_SUCCESS) @@ -402,7 +402,7 @@ void UT_os_setlocaltime_test() { UtPrintf("OS_SetLocalTime() - #3 Nominal "); UtPrintf("[Expecting output after API call to increase over time: %ld.%ld]\n", - (long)OS_TimeGetTotalSeconds(time_struct), (long)OS_TimeGetMicrosecondsPart(time_struct)); + (long)OS_TimeGetTotalSeconds(time_struct), (long)OS_TimeGetMicrosecondsPart(time_struct)); OS_TaskDelay(20); OS_GetLocalTime(&time_struct); diff --git a/src/unit-tests/oscore-test/ut_oscore_misc_test.h b/src/unit-tests/oscore-test/ut_oscore_misc_test.h index ffed19bea..4cf6fb5c5 100644 --- a/src/unit-tests/oscore-test/ut_oscore_misc_test.h +++ b/src/unit-tests/oscore-test/ut_oscore_misc_test.h @@ -68,7 +68,7 @@ void UT_os_heapgetinfo_test(void); /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSCORE_MISC_TEST_H */ +#endif /* UT_OSCORE_MISC_TEST_H */ /*================================================================================* ** End of File: ut_oscore_misc_test.h diff --git a/src/unit-tests/oscore-test/ut_oscore_mutex_test.h b/src/unit-tests/oscore-test/ut_oscore_mutex_test.h index a476ca410..50fdec19b 100644 --- a/src/unit-tests/oscore-test/ut_oscore_mutex_test.h +++ b/src/unit-tests/oscore-test/ut_oscore_mutex_test.h @@ -62,7 +62,7 @@ void UT_os_mut_sem_get_info_test(void); /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSCORE_MUTEX_TEST_H */ +#endif /* UT_OSCORE_MUTEX_TEST_H */ /*================================================================================* ** End of File: ut_oscore_mutex_test.h diff --git a/src/unit-tests/oscore-test/ut_oscore_queue_test.h b/src/unit-tests/oscore-test/ut_oscore_queue_test.h index 1499ac770..1a45d3e2e 100644 --- a/src/unit-tests/oscore-test/ut_oscore_queue_test.h +++ b/src/unit-tests/oscore-test/ut_oscore_queue_test.h @@ -62,7 +62,7 @@ void UT_os_queue_get_info_test(void); /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSCORE_QUEUE_TEST_H */ +#endif /* UT_OSCORE_QUEUE_TEST_H */ /*================================================================================* ** End of File: ut_oscore_queue_test.h diff --git a/src/unit-tests/oscore-test/ut_oscore_select_test.h b/src/unit-tests/oscore-test/ut_oscore_select_test.h index ab2e57c6b..467e5707a 100644 --- a/src/unit-tests/oscore-test/ut_oscore_select_test.h +++ b/src/unit-tests/oscore-test/ut_oscore_select_test.h @@ -59,7 +59,7 @@ void UT_os_select_multi_test(void); /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSCORE_SELECT_TEST_H */ +#endif /* UT_OSCORE_SELECT_TEST_H */ /*================================================================================* ** End of File: ut_oscore_select_test.h diff --git a/src/unit-tests/oscore-test/ut_oscore_task_test.c b/src/unit-tests/oscore-test/ut_oscore_task_test.c index ff53e9f56..41dd84e80 100644 --- a/src/unit-tests/oscore-test/ut_oscore_task_test.c +++ b/src/unit-tests/oscore-test/ut_oscore_task_test.c @@ -815,7 +815,7 @@ void UT_os_task_get_id_test() OS_TaskDelay(500); UtPrintf("OS_TaskGetId() - #1 Nominal [This is the expected task Id=%lx]\n", - OS_ObjectIdToInteger(g_task_ids[1])); + OS_ObjectIdToInteger(g_task_ids[1])); res = OS_TaskDelete(g_task_ids[1]); /* Won't hurt if its already deleted */ diff --git a/src/unit-tests/oscore-test/ut_oscore_task_test.h b/src/unit-tests/oscore-test/ut_oscore_task_test.h index 69425ad15..60b35ad5b 100644 --- a/src/unit-tests/oscore-test/ut_oscore_task_test.h +++ b/src/unit-tests/oscore-test/ut_oscore_task_test.h @@ -69,7 +69,7 @@ void UT_os_task_get_id_test(void); /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSCORE_TASK_TEST_H */ +#endif /* UT_OSCORE_TASK_TEST_H */ /*================================================================================* ** End of File: ut_oscore_task_test.h diff --git a/src/unit-tests/oscore-test/ut_oscore_test.h b/src/unit-tests/oscore-test/ut_oscore_test.h index 90848ac2b..2c412a6a0 100644 --- a/src/unit-tests/oscore-test/ut_oscore_test.h +++ b/src/unit-tests/oscore-test/ut_oscore_test.h @@ -62,7 +62,7 @@ /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSCORE_TEST_H */ +#endif /* UT_OSCORE_TEST_H */ /*================================================================================* ** End of File: ut_oscore_test_posix.h diff --git a/src/unit-tests/osfile-test/ut_osfile_dirio_test.c b/src/unit-tests/osfile-test/ut_osfile_dirio_test.c index 974b808bc..40540e824 100644 --- a/src/unit-tests/osfile-test/ut_osfile_dirio_test.c +++ b/src/unit-tests/osfile-test/ut_osfile_dirio_test.c @@ -439,7 +439,7 @@ void UT_os_closedir_test() **--------------------------------------------------------------------------------*/ void UT_os_readdir_test() { - osal_id_t dirh; + osal_id_t dirh = OS_OBJECT_ID_UNDEFINED; const char *testDesc; strcpy(g_subdirNames[0], " "); @@ -566,7 +566,7 @@ void UT_os_readdir_test() **--------------------------------------------------------------------------------*/ void UT_os_rewinddir_test() { - osal_id_t dirh; + osal_id_t dirh = OS_OBJECT_ID_UNDEFINED; const char *testDesc; strcpy(g_subdirNames[0], " "); diff --git a/src/unit-tests/osfile-test/ut_osfile_dirio_test.h b/src/unit-tests/osfile-test/ut_osfile_dirio_test.h index 62cca6385..04ff11525 100644 --- a/src/unit-tests/osfile-test/ut_osfile_dirio_test.h +++ b/src/unit-tests/osfile-test/ut_osfile_dirio_test.h @@ -64,7 +64,7 @@ void UT_os_removedir_test(void); /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSFILE_DIRIO_H */ +#endif /* UT_OSFILE_DIRIO_H */ /*================================================================================* ** End of File: ut_osfile_dirio.h diff --git a/src/unit-tests/osfile-test/ut_osfile_fileio_test.c b/src/unit-tests/osfile-test/ut_osfile_fileio_test.c index 5f1f59b4c..df94fe0e2 100644 --- a/src/unit-tests/osfile-test/ut_osfile_fileio_test.c +++ b/src/unit-tests/osfile-test/ut_osfile_fileio_test.c @@ -116,7 +116,7 @@ void UT_os_initfs_test() /*-----------------------------------------------------*/ testDesc = "#2 Nominal"; - /* Call to OS_FS_Init() is inside OS_API_Init(); */ + /* Call to OS_FS_Init is inside OS_API_Init */ res = OS_API_Init(); if (res == OS_ERR_NOT_IMPLEMENTED) { diff --git a/src/unit-tests/osfile-test/ut_osfile_fileio_test.h b/src/unit-tests/osfile-test/ut_osfile_fileio_test.h index c605f912b..6f149a3ca 100644 --- a/src/unit-tests/osfile-test/ut_osfile_fileio_test.h +++ b/src/unit-tests/osfile-test/ut_osfile_fileio_test.h @@ -80,7 +80,7 @@ void UT_os_closefilebyname_test(void); /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSFILE_FILEIO_H */ +#endif /* UT_OSFILE_FILEIO_H */ /*================================================================================* ** End of File: ut_osfile_fileio.h diff --git a/src/unit-tests/osfile-test/ut_osfile_test.h b/src/unit-tests/osfile-test/ut_osfile_test.h index ab4c9c624..53459e6e4 100644 --- a/src/unit-tests/osfile-test/ut_osfile_test.h +++ b/src/unit-tests/osfile-test/ut_osfile_test.h @@ -57,7 +57,7 @@ /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSFILE_TEST_H */ +#endif /* UT_OSFILE_TEST_H */ /*================================================================================* ** End of File: ut_osfile_test.h diff --git a/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.c b/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.c index e9938c84a..dd28ae4ee 100644 --- a/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.c +++ b/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.c @@ -1053,7 +1053,6 @@ void UT_os_checkfs_test() return; } - /*--------------------------------------------------------------------------------* ** Syntax: int32 OS_fsstatvolume(const char *name) ** Purpose: Returns the number of blocks free in a the file system diff --git a/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.h b/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.h index b9141a773..b2573eb66 100644 --- a/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.h +++ b/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.h @@ -73,7 +73,7 @@ void UT_os_fsstatvolume_test(void); /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSFILESYS_DISKIO_TEST_H */ +#endif /* UT_OSFILESYS_DISKIO_TEST_H */ /*================================================================================* ** End of File: ut_osfilesys_diskio_test.h diff --git a/src/unit-tests/osfilesys-test/ut_osfilesys_test.h b/src/unit-tests/osfilesys-test/ut_osfilesys_test.h index d80f62bdc..7e78dbd91 100644 --- a/src/unit-tests/osfilesys-test/ut_osfilesys_test.h +++ b/src/unit-tests/osfilesys-test/ut_osfilesys_test.h @@ -56,7 +56,7 @@ /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSFILESYS_TEST_H */ +#endif /* UT_OSFILESYS_TEST_H */ /*================================================================================* ** End of File: ut_osfilesys_test.h diff --git a/src/unit-tests/osloader-test/ut_osloader_module_test.h b/src/unit-tests/osloader-test/ut_osloader_module_test.h index c63c923f5..70057ea10 100644 --- a/src/unit-tests/osloader-test/ut_osloader_module_test.h +++ b/src/unit-tests/osloader-test/ut_osloader_module_test.h @@ -59,7 +59,7 @@ void UT_os_module_info_test(void); /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSLOADER_MODULE_TEST_H */ +#endif /* UT_OSLOADER_MODULE_TEST_H */ /*================================================================================* ** End of File: ut_osloader_module_test.h diff --git a/src/unit-tests/osloader-test/ut_osloader_symtable_test.c b/src/unit-tests/osloader-test/ut_osloader_symtable_test.c index 1ccf5a5c4..b81ddb1ec 100644 --- a/src/unit-tests/osloader-test/ut_osloader_symtable_test.c +++ b/src/unit-tests/osloader-test/ut_osloader_symtable_test.c @@ -213,7 +213,6 @@ void UT_os_module_symbol_lookup_test() return; } - /*--------------------------------------------------------------------------------* ** Syntax: OS_SymbolTableDump ** Purpose: Dumps the system symbol table to the given filename diff --git a/src/unit-tests/osloader-test/ut_osloader_symtable_test.h b/src/unit-tests/osloader-test/ut_osloader_symtable_test.h index de756c85e..5e572362a 100644 --- a/src/unit-tests/osloader-test/ut_osloader_symtable_test.h +++ b/src/unit-tests/osloader-test/ut_osloader_symtable_test.h @@ -59,7 +59,7 @@ void UT_os_symbol_table_dump_test(void); /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSLOADER_SYMTABLE_TEST_H */ +#endif /* UT_OSLOADER_SYMTABLE_TEST_H */ /*================================================================================* ** End of File: ut_osloader_symtable_test.h diff --git a/src/unit-tests/osloader-test/ut_osloader_test.h b/src/unit-tests/osloader-test/ut_osloader_test.h index 43941ef39..61c0175d6 100644 --- a/src/unit-tests/osloader-test/ut_osloader_test.h +++ b/src/unit-tests/osloader-test/ut_osloader_test.h @@ -57,7 +57,7 @@ /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSLOADER_TEST_H */ +#endif /* UT_OSLOADER_TEST_H */ /*================================================================================* ** End of File: ut_osloader_test.h diff --git a/src/unit-tests/osloader-test/ut_osloader_test_platforms.h b/src/unit-tests/osloader-test/ut_osloader_test_platforms.h index 49aadbe12..0e62c9206 100644 --- a/src/unit-tests/osloader-test/ut_osloader_test_platforms.h +++ b/src/unit-tests/osloader-test/ut_osloader_test_platforms.h @@ -63,7 +63,7 @@ /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSLOADER_TEST_PLATFORMS_H */ +#endif /* UT_OSLOADER_TEST_PLATFORMS_H */ /*================================================================================* ** End of File: ut_osloader_test_platforms.h diff --git a/src/unit-tests/osnetwork-test/ut_osnetwork_misc_test.h b/src/unit-tests/osnetwork-test/ut_osnetwork_misc_test.h index aeb22d05f..038aff40f 100644 --- a/src/unit-tests/osnetwork-test/ut_osnetwork_misc_test.h +++ b/src/unit-tests/osnetwork-test/ut_osnetwork_misc_test.h @@ -58,7 +58,7 @@ void UT_os_networkgethostname_test(void); /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSNETWORK_MISC_TEST_H */ +#endif /* UT_OSNETWORK_MISC_TEST_H */ /*================================================================================* ** End of File: ut_osnetwork_misc_test.h diff --git a/src/unit-tests/osnetwork-test/ut_osnetwork_test.h b/src/unit-tests/osnetwork-test/ut_osnetwork_test.h index 8a08d2767..90a29fc72 100644 --- a/src/unit-tests/osnetwork-test/ut_osnetwork_test.h +++ b/src/unit-tests/osnetwork-test/ut_osnetwork_test.h @@ -56,7 +56,7 @@ /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSNETWORK_TEST_H */ +#endif /* UT_OSNETWORK_TEST_H */ /*================================================================================* ** End of File: ut_osnetwork_test.h diff --git a/src/unit-tests/ostimer-test/ut_ostimer_test.h b/src/unit-tests/ostimer-test/ut_ostimer_test.h index e5f890386..126611d5c 100644 --- a/src/unit-tests/ostimer-test/ut_ostimer_test.h +++ b/src/unit-tests/ostimer-test/ut_ostimer_test.h @@ -56,7 +56,7 @@ /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSTIMER_TEST_H */ +#endif /* UT_OSTIMER_TEST_H */ /*================================================================================* ** End of File: ut_ostimer_test.h diff --git a/src/unit-tests/ostimer-test/ut_ostimer_timerio_test.h b/src/unit-tests/ostimer-test/ut_ostimer_timerio_test.h index 9a1501906..eec6a7e94 100644 --- a/src/unit-tests/ostimer-test/ut_ostimer_timerio_test.h +++ b/src/unit-tests/ostimer-test/ut_ostimer_timerio_test.h @@ -64,7 +64,7 @@ void UT_os_timergetinfo_test(void); /*--------------------------------------------------------------------------------*/ -#endif /* UT_OSTIMER_TIMERIO_TEST_H */ +#endif /* UT_OSTIMER_TIMERIO_TEST_H */ /*================================================================================* ** End of File: ut_ostimer_timerio_test.h diff --git a/src/ut-stubs/osapi-utstub-binsem.c b/src/ut-stubs/osapi-utstub-binsem.c index e85d4559e..f2f1c746e 100644 --- a/src/ut-stubs/osapi-utstub-binsem.c +++ b/src/ut-stubs/osapi-utstub-binsem.c @@ -131,7 +131,7 @@ int32 OS_BinSemCreate(osal_id_t *sem_id, const char *sem_name, uint32 sem_initia if (status == OS_SUCCESS) { - *sem_id = UT_AllocStubObjId(UT_OBJTYPE_BINSEM); + *sem_id = UT_AllocStubObjId(OS_OBJECT_TYPE_OS_BINSEM); } else { @@ -196,9 +196,9 @@ int32 OS_BinSemGetInfo(osal_id_t sem_id, OS_bin_sem_prop_t *bin_prop) if (status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_BinSemGetInfo), bin_prop, sizeof(*bin_prop)) < sizeof(*bin_prop)) { - UT_ObjIdCompose(1, UT_OBJTYPE_TASK, &bin_prop->creator); - strncpy(bin_prop->name, "Name", OS_MAX_API_NAME - 1); - bin_prop->name[OS_MAX_API_NAME - 1] = '\0'; + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_TASK, &bin_prop->creator); + strncpy(bin_prop->name, "Name", sizeof(bin_prop->name) - 1); + bin_prop->name[sizeof(bin_prop->name) - 1] = '\0'; } return status; @@ -234,7 +234,7 @@ int32 OS_BinSemDelete(osal_id_t sem_id) if (status == OS_SUCCESS) { - UT_DeleteStubObjId(UT_OBJTYPE_BINSEM, sem_id); + UT_DeleteStubObjId(OS_OBJECT_TYPE_OS_BINSEM, sem_id); } return status; @@ -288,7 +288,7 @@ int32 OS_BinSemGetIdByName(osal_id_t *sem_id, const char *sem_name) if (status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_BinSemGetIdByName), sem_id, sizeof(*sem_id)) < sizeof(*sem_id)) { - UT_ObjIdCompose(1, UT_OBJTYPE_BINSEM, sem_id); + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_BINSEM, sem_id); } return status; diff --git a/src/ut-stubs/osapi-utstub-bsp.c b/src/ut-stubs/osapi-utstub-bsp.c index 0b2acd90d..126b5bb7f 100644 --- a/src/ut-stubs/osapi-utstub-bsp.c +++ b/src/ut-stubs/osapi-utstub-bsp.c @@ -56,7 +56,7 @@ uint32 OS_BSP_GetArgC(void) ------------------------------------------------------------------*/ char *const *OS_BSP_GetArgV(void) { - void *buffer; + void *buffer = NULL; int32 status; status = UT_DEFAULT_IMPL(OS_BSP_GetArgV); diff --git a/src/ut-stubs/osapi-utstub-countsem.c b/src/ut-stubs/osapi-utstub-countsem.c index f4c4d3934..31c7faaa7 100644 --- a/src/ut-stubs/osapi-utstub-countsem.c +++ b/src/ut-stubs/osapi-utstub-countsem.c @@ -55,7 +55,7 @@ int32 OS_CountSemCreate(osal_id_t *sem_id, const char *sem_name, uint32 sem_init if (status == OS_SUCCESS) { - *sem_id = UT_AllocStubObjId(UT_OBJTYPE_COUNTSEM); + *sem_id = UT_AllocStubObjId(OS_OBJECT_TYPE_OS_COUNTSEM); } else { @@ -95,7 +95,7 @@ int32 OS_CountSemDelete(osal_id_t sem_id) if (status == OS_SUCCESS) { - UT_DeleteStubObjId(UT_OBJTYPE_COUNTSEM, sem_id); + UT_DeleteStubObjId(OS_OBJECT_TYPE_OS_COUNTSEM, sem_id); } return status; @@ -167,7 +167,7 @@ int32 OS_CountSemGetIdByName(osal_id_t *sem_id, const char *sem_name) if (status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_CountSemGetIdByName), sem_id, sizeof(*sem_id)) < sizeof(*sem_id)) { - UT_ObjIdCompose(1, UT_OBJTYPE_COUNTSEM, sem_id); + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_COUNTSEM, sem_id); } return status; @@ -201,9 +201,9 @@ int32 OS_CountSemGetInfo(osal_id_t sem_id, OS_count_sem_prop_t *count_prop) if (status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_CountSemGetInfo), count_prop, sizeof(*count_prop)) < sizeof(*count_prop)) { - UT_ObjIdCompose(1, UT_OBJTYPE_TASK, &count_prop->creator); - strncpy(count_prop->name, "Name", OS_MAX_API_NAME - 1); - count_prop->name[OS_MAX_API_NAME - 1] = '\0'; + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_TASK, &count_prop->creator); + strncpy(count_prop->name, "Name", sizeof(count_prop->name) - 1); + count_prop->name[sizeof(count_prop->name) - 1] = '\0'; } return status; diff --git a/src/ut-stubs/osapi-utstub-dir.c b/src/ut-stubs/osapi-utstub-dir.c index 7f53306e8..43ad38760 100644 --- a/src/ut-stubs/osapi-utstub-dir.c +++ b/src/ut-stubs/osapi-utstub-dir.c @@ -86,7 +86,7 @@ int32 OS_DirectoryOpen(osal_id_t *dir_id, const char *path) if (Status == OS_SUCCESS) { - *dir_id = UT_AllocStubObjId(UT_OBJTYPE_DIR); + *dir_id = UT_AllocStubObjId(OS_OBJECT_TYPE_OS_DIR); } else { @@ -111,7 +111,7 @@ int32 OS_DirectoryClose(osal_id_t dir_id) if (Status == OS_SUCCESS) { - UT_DeleteStubObjId(UT_OBJTYPE_DIR, dir_id); + UT_DeleteStubObjId(OS_OBJECT_TYPE_OS_DIR, dir_id); } return Status; diff --git a/src/ut-stubs/osapi-utstub-file.c b/src/ut-stubs/osapi-utstub-file.c index 6efd2913f..29a73f4c6 100644 --- a/src/ut-stubs/osapi-utstub-file.c +++ b/src/ut-stubs/osapi-utstub-file.c @@ -126,7 +126,7 @@ int32 OS_creat(const char *path, int32 access) if (status == OS_SUCCESS) { - objid = UT_AllocStubObjId(UT_OBJTYPE_FILESTREAM); + objid = UT_AllocStubObjId(OS_OBJECT_TYPE_OS_STREAM); status = OS_ObjectIdToInteger(objid); } @@ -150,7 +150,7 @@ int32 OS_open(const char *path, int32 access, uint32 mode) if (status == OS_SUCCESS) { - objid = UT_AllocStubObjId(UT_OBJTYPE_FILESTREAM); + objid = UT_AllocStubObjId(OS_OBJECT_TYPE_OS_STREAM); status = OS_ObjectIdToInteger(objid); } @@ -175,7 +175,7 @@ int32 OS_OpenCreate(osal_id_t *filedes, const char *path, int32 flags, int32 acc status = UT_DEFAULT_IMPL(OS_OpenCreate); if (status == OS_SUCCESS) { - *filedes = UT_AllocStubObjId(UT_OBJTYPE_FILESTREAM); + *filedes = UT_AllocStubObjId(OS_OBJECT_TYPE_OS_STREAM); } else { @@ -200,7 +200,7 @@ int32 OS_close(osal_id_t filedes) if (status == OS_SUCCESS) { - UT_DeleteStubObjId(UT_OBJTYPE_FILESTREAM, filedes); + UT_DeleteStubObjId(OS_OBJECT_TYPE_OS_STREAM, filedes); } return status; @@ -430,7 +430,7 @@ int32 OS_FDGetInfo(osal_id_t filedes, OS_file_prop_t *fd_prop) { memset(fd_prop, 0, sizeof(*fd_prop)); fd_prop->IsValid = true; - UT_ObjIdCompose(1, UT_OBJTYPE_TASK, &fd_prop->User); + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_TASK, &fd_prop->User); } } diff --git a/src/ut-stubs/osapi-utstub-filesys.c b/src/ut-stubs/osapi-utstub-filesys.c index f0f4d6175..57393fc7a 100644 --- a/src/ut-stubs/osapi-utstub-filesys.c +++ b/src/ut-stubs/osapi-utstub-filesys.c @@ -54,7 +54,7 @@ int32 OS_FileSysAddFixedMap(osal_id_t *filesys_id, const char *phys_path, const if (status == OS_SUCCESS) { - *filesys_id = UT_AllocStubObjId(UT_OBJTYPE_FILESYS); + *filesys_id = UT_AllocStubObjId(OS_OBJECT_TYPE_OS_FILESYS); } else { @@ -153,7 +153,7 @@ int32 OS_unmount(const char *mountpoint) return status; } -#ifndef OSAL_OMIT_DEPRECATED +#ifndef OSAL_OMIT_DEPRECATED /***************************************************************************** * @@ -210,7 +210,8 @@ int32 OS_FileSysStatVolume(const char *name, OS_statvfs_t *statbuf) status = UT_DEFAULT_IMPL(OS_FileSysStatVolume); - if (status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_FileSysStatVolume), statbuf, sizeof(*statbuf)) < sizeof(*statbuf)) + if (status == OS_SUCCESS && + UT_Stub_CopyToLocal(UT_KEY(OS_FileSysStatVolume), statbuf, sizeof(*statbuf)) < sizeof(*statbuf)) { memset(statbuf, 0, sizeof(*statbuf)); } @@ -248,7 +249,8 @@ int32 OS_FS_GetPhysDriveName(char *PhysDriveName, const char *MountPoint) int32 status; status = UT_DEFAULT_IMPL(OS_FS_GetPhysDriveName); - strncpy(PhysDriveName, MountPoint, OS_FS_PHYS_NAME_LEN); + strncpy(PhysDriveName, MountPoint, OS_FS_PHYS_NAME_LEN - 1); + PhysDriveName[OS_FS_PHYS_NAME_LEN - 1] = 0; return status; } @@ -287,7 +289,8 @@ int32 OS_TranslatePath(const char *VirtualPath, char *LocalPath) if (status == OS_SUCCESS && VirtualPath != NULL && LocalPath != NULL && UT_Stub_CopyToLocal(UT_KEY(OS_TranslatePath), LocalPath, OS_MAX_LOCAL_PATH_LEN) == 0) { - strncpy(LocalPath, VirtualPath, OS_MAX_LOCAL_PATH_LEN); + strncpy(LocalPath, VirtualPath, OS_MAX_LOCAL_PATH_LEN - 1); + LocalPath[OS_MAX_LOCAL_PATH_LEN - 1] = 0; } return status; diff --git a/src/ut-stubs/osapi-utstub-idmap.c b/src/ut-stubs/osapi-utstub-idmap.c index 4b2bd3992..4521ba0e8 100644 --- a/src/ut-stubs/osapi-utstub-idmap.c +++ b/src/ut-stubs/osapi-utstub-idmap.c @@ -43,7 +43,7 @@ /* * UT Helper function to create a fake object lock token */ -static void UT_TokenCompose(uint32 lock_mode, uint32 indx, UT_ObjType_t objtype, OS_object_token_t *token) +static void UT_TokenCompose(uint32 lock_mode, uint32 indx, osal_objtype_t objtype, OS_object_token_t *token) { token->lock_mode = lock_mode; token->obj_type = objtype; @@ -72,7 +72,7 @@ uint32 OS_GetMaxForObjectType(osal_objtype_t idtype) { int32 max; - if (idtype > UT_OBJTYPE_NONE && idtype < UT_OBJTYPE_MAX) + if (idtype > OS_OBJECT_TYPE_UNDEFINED && idtype < OS_OBJECT_TYPE_USER) { max = OSAL_MAX_VALID_PER_TYPE; } @@ -93,7 +93,7 @@ uint32 OS_GetBaseForObjectType(osal_objtype_t idtype) { int32 base; - if (idtype > UT_OBJTYPE_NONE && idtype < UT_OBJTYPE_MAX) + if (idtype > OS_OBJECT_TYPE_UNDEFINED && idtype < OS_OBJECT_TYPE_USER) { base = OSAL_MAX_VALID_PER_TYPE * (idtype - 1); } @@ -112,9 +112,9 @@ uint32 OS_GetBaseForObjectType(osal_objtype_t idtype) *****************************************************************************/ int32 OS_ObjectIdToArrayIndex(osal_objtype_t idtype, osal_id_t id, osal_index_t *ArrayIndex) { - int32 Status; - UT_ObjType_t checktype; - uint32 tempserial; + int32 Status; + osal_objtype_t checktype; + uint32 tempserial; Status = UT_DEFAULT_IMPL(OS_ObjectIdToArrayIndex); @@ -138,7 +138,7 @@ OS_common_record_t *OS_ObjectIdGlobalFromToken(const OS_object_token_t *token) { static OS_common_record_t fake_record; int32 status; - OS_common_record_t * recptr; + OS_common_record_t * recptr = &fake_record; status = UT_DEFAULT_IMPL(OS_ObjectIdGlobalFromToken); if (status == 0 && @@ -457,9 +457,9 @@ int32 OS_ConvertToArrayIndex(osal_id_t object_id, osal_index_t *ArrayIndex) if (return_code == OS_SUCCESS) { - UT_ObjType_t ObjType; + osal_objtype_t ObjType; UT_ObjIdDecompose(object_id, &tempserial, &ObjType); - if (ObjType != UT_OBJTYPE_NONE && ObjType < UT_OBJTYPE_MAX) + if (ObjType != OS_OBJECT_TYPE_UNDEFINED && ObjType < OS_OBJECT_TYPE_USER) { tempserial %= UT_MAXOBJS[ObjType]; } @@ -603,7 +603,7 @@ void OS_ObjectIdIteratorDestroy(OS_object_iter_t *iter) UT_DEFAULT_IMPL(OS_ObjectIdIteratorDestroy); } -int32 OS_ObjectIdIteratorProcessEntry(OS_object_iter_t *iter, int32 (*func)(osal_id_t, void*)) +int32 OS_ObjectIdIteratorProcessEntry(OS_object_iter_t *iter, int32 (*func)(osal_id_t, void *)) { int32 Status; @@ -623,53 +623,13 @@ osal_objtype_t OS_IdentifyObject(osal_id_t object_id) { UT_Stub_RegisterContextGenericArg(UT_KEY(OS_IdentifyObject), object_id); - UT_ObjType_t ObjType; - uint32 checkindx; - int32 DefaultType; + osal_objtype_t ObjType; + uint32 checkindx; + int32 DefaultType; UT_ObjIdDecompose(object_id, &checkindx, &ObjType); - switch (ObjType) - { - case UT_OBJTYPE_TASK: - DefaultType = OS_OBJECT_TYPE_OS_TASK; - break; - case UT_OBJTYPE_QUEUE: - DefaultType = OS_OBJECT_TYPE_OS_QUEUE; - break; - case UT_OBJTYPE_COUNTSEM: - DefaultType = OS_OBJECT_TYPE_OS_COUNTSEM; - break; - case UT_OBJTYPE_BINSEM: - DefaultType = OS_OBJECT_TYPE_OS_BINSEM; - break; - case UT_OBJTYPE_MUTEX: - DefaultType = OS_OBJECT_TYPE_OS_MUTEX; - break; - case UT_OBJTYPE_TIMECB: - DefaultType = OS_OBJECT_TYPE_OS_TIMECB; - break; - case UT_OBJTYPE_MODULE: - DefaultType = OS_OBJECT_TYPE_OS_MODULE; - break; - case UT_OBJTYPE_FILESTREAM: - DefaultType = OS_OBJECT_TYPE_OS_STREAM; - break; - case UT_OBJTYPE_TIMEBASE: - DefaultType = OS_OBJECT_TYPE_OS_TIMEBASE; - break; - case UT_OBJTYPE_DIR: - DefaultType = OS_OBJECT_TYPE_OS_DIR; - break; - case UT_OBJTYPE_FILESYS: - DefaultType = OS_OBJECT_TYPE_OS_FILESYS; - break; - default: - DefaultType = OS_OBJECT_TYPE_UNDEFINED; - break; - } - - DefaultType = UT_DEFAULT_IMPL_RC(OS_IdentifyObject, DefaultType); + DefaultType = UT_DEFAULT_IMPL_RC(OS_IdentifyObject, ObjType); return DefaultType; } diff --git a/src/ut-stubs/osapi-utstub-module.c b/src/ut-stubs/osapi-utstub-module.c index 793369360..e62c85d2b 100644 --- a/src/ut-stubs/osapi-utstub-module.c +++ b/src/ut-stubs/osapi-utstub-module.c @@ -94,7 +94,7 @@ int32 OS_ModuleLoad(osal_id_t *module_id, const char *module_name, const char *f if (status == OS_SUCCESS) { - *module_id = UT_AllocStubObjId(UT_OBJTYPE_MODULE); + *module_id = UT_AllocStubObjId(OS_OBJECT_TYPE_OS_MODULE); } else { @@ -134,7 +134,7 @@ int32 OS_ModuleUnload(osal_id_t module_id) if (status == OS_SUCCESS) { - UT_DeleteStubObjId(UT_OBJTYPE_MODULE, module_id); + UT_DeleteStubObjId(OS_OBJECT_TYPE_OS_MODULE, module_id); } return status; diff --git a/src/ut-stubs/osapi-utstub-mutex.c b/src/ut-stubs/osapi-utstub-mutex.c index baf060e93..89912f6e6 100644 --- a/src/ut-stubs/osapi-utstub-mutex.c +++ b/src/ut-stubs/osapi-utstub-mutex.c @@ -70,7 +70,7 @@ int32 OS_MutSemCreate(osal_id_t *sem_id, const char *sem_name, uint32 options) if (status == OS_SUCCESS) { - *sem_id = UT_AllocStubObjId(UT_OBJTYPE_MUTEX); + *sem_id = UT_AllocStubObjId(OS_OBJECT_TYPE_OS_MUTEX); } else { @@ -110,7 +110,7 @@ int32 OS_MutSemDelete(osal_id_t sem_id) if (status == OS_SUCCESS) { - UT_DeleteStubObjId(UT_OBJTYPE_MUTEX, sem_id); + UT_DeleteStubObjId(OS_OBJECT_TYPE_OS_MUTEX, sem_id); } return status; @@ -195,7 +195,7 @@ int32 OS_MutSemGetIdByName(osal_id_t *sem_id, const char *sem_name) if (status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_MutSemGetIdByName), sem_id, sizeof(*sem_id)) < sizeof(*sem_id)) { - UT_ObjIdCompose(1, UT_OBJTYPE_MUTEX, sem_id); + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_MUTEX, sem_id); } return status; @@ -229,9 +229,9 @@ int32 OS_MutSemGetInfo(osal_id_t sem_id, OS_mut_sem_prop_t *mut_prop) if (status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_MutSemGetInfo), mut_prop, sizeof(*mut_prop)) < sizeof(*mut_prop)) { - strncpy(mut_prop->name, "Name", OS_MAX_API_NAME - 1); - mut_prop->name[OS_MAX_API_NAME - 1] = '\0'; - UT_ObjIdCompose(1, UT_OBJTYPE_TASK, &mut_prop->creator); + strncpy(mut_prop->name, "Name", sizeof(mut_prop->name) - 1); + mut_prop->name[sizeof(mut_prop->name) - 1] = '\0'; + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_TASK, &mut_prop->creator); } return status; diff --git a/src/ut-stubs/osapi-utstub-queue.c b/src/ut-stubs/osapi-utstub-queue.c index 77ed039ac..faa7fe675 100644 --- a/src/ut-stubs/osapi-utstub-queue.c +++ b/src/ut-stubs/osapi-utstub-queue.c @@ -78,7 +78,7 @@ int32 OS_QueueCreate(osal_id_t *queue_id, const char *queue_name, osal_blockcoun if (status == OS_SUCCESS) { - *queue_id = UT_AllocStubObjId(UT_OBJTYPE_QUEUE); + *queue_id = UT_AllocStubObjId(OS_OBJECT_TYPE_OS_QUEUE); } else { @@ -121,7 +121,7 @@ int32 OS_QueueDelete(osal_id_t queue_id) if (status == OS_SUCCESS) { - UT_DeleteStubObjId(UT_OBJTYPE_QUEUE, queue_id); + UT_DeleteStubObjId(OS_OBJECT_TYPE_OS_QUEUE, queue_id); } return status; @@ -235,7 +235,7 @@ int32 OS_QueueGetIdByName(osal_id_t *queue_id, const char *queue_name) if (status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_QueueGetIdByName), queue_id, sizeof(*queue_id)) < sizeof(*queue_id)) { - UT_ObjIdCompose(1, UT_OBJTYPE_QUEUE, queue_id); + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_QUEUE, queue_id); } return status; @@ -269,9 +269,9 @@ int32 OS_QueueGetInfo(osal_id_t queue_id, OS_queue_prop_t *queue_prop) if (status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_QueueGetInfo), queue_prop, sizeof(*queue_prop)) < sizeof(*queue_prop)) { - UT_ObjIdCompose(1, UT_OBJTYPE_TASK, &queue_prop->creator); - strncpy(queue_prop->name, "Name", OS_MAX_API_NAME - 1); - queue_prop->name[OS_MAX_API_NAME - 1] = '\0'; + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_TASK, &queue_prop->creator); + strncpy(queue_prop->name, "Name", sizeof(queue_prop->name) - 1); + queue_prop->name[sizeof(queue_prop->name) - 1] = '\0'; } return status; diff --git a/src/ut-stubs/osapi-utstub-sockets.c b/src/ut-stubs/osapi-utstub-sockets.c index 3eb783d15..5a211c846 100644 --- a/src/ut-stubs/osapi-utstub-sockets.c +++ b/src/ut-stubs/osapi-utstub-sockets.c @@ -52,7 +52,7 @@ int32 OS_SocketOpen(osal_id_t *sock_id, OS_SocketDomain_t Domain, OS_SocketType_ if (status == OS_SUCCESS) { - *sock_id = UT_AllocStubObjId(UT_OBJTYPE_SOCKET); + *sock_id = UT_AllocStubObjId(OS_OBJECT_TYPE_OS_STREAM); } return status; @@ -209,7 +209,7 @@ int32 OS_SocketGetIdByName(osal_id_t *sock_id, const char *sock_name) if (status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_SocketGetIdByName), sock_id, sizeof(*sock_id)) < sizeof(*sock_id)) { - UT_ObjIdCompose(1, UT_OBJTYPE_SOCKET, sock_id); + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_STREAM, sock_id); } return status; @@ -236,8 +236,9 @@ int32 OS_SocketGetInfo(osal_id_t sock_id, OS_socket_prop_t *sock_prop) CopySize = UT_Stub_CopyToLocal(UT_KEY(OS_SocketGetInfo), sock_prop, sizeof(*sock_prop)); if (CopySize < sizeof(*sock_prop)) { - UT_ObjIdCompose(1, UT_OBJTYPE_TASK, &sock_prop->creator); - strncpy(sock_prop->name, "ut", sizeof(sock_prop->name)); + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_TASK, &sock_prop->creator); + strncpy(sock_prop->name, "ut", sizeof(sock_prop->name) - 1); + sock_prop->name[sizeof(sock_prop->name) - 1] = 0; } } diff --git a/src/ut-stubs/osapi-utstub-task.c b/src/ut-stubs/osapi-utstub-task.c index f29990f8b..ce3dc4c80 100644 --- a/src/ut-stubs/osapi-utstub-task.c +++ b/src/ut-stubs/osapi-utstub-task.c @@ -70,7 +70,7 @@ int32 OS_TaskCreate(osal_id_t *task_id, const char *task_name, osal_task_entry f if (status == OS_SUCCESS) { - *task_id = UT_AllocStubObjId(UT_OBJTYPE_TASK); + *task_id = UT_AllocStubObjId(OS_OBJECT_TYPE_OS_TASK); } else { @@ -106,7 +106,7 @@ int32 OS_TaskDelete(osal_id_t task_id) if (status == OS_SUCCESS) { - UT_DeleteStubObjId(UT_OBJTYPE_TASK, task_id); + UT_DeleteStubObjId(OS_OBJECT_TYPE_OS_TASK, task_id); } return status; @@ -224,7 +224,7 @@ osal_id_t OS_TaskGetId(void) int32 status; status = UT_DEFAULT_IMPL_RC(OS_TaskGetId, 1); - UT_ObjIdCompose(status, UT_OBJTYPE_TASK, &TaskId); + UT_ObjIdCompose(status, OS_OBJECT_TYPE_OS_TASK, &TaskId); return TaskId; } @@ -246,7 +246,7 @@ int32 OS_TaskGetIdByName(osal_id_t *task_id, const char *task_name) if (status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_TaskGetIdByName), task_id, sizeof(*task_id)) < sizeof(*task_id)) { - UT_ObjIdCompose(1, UT_OBJTYPE_TASK, task_id); + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_TASK, task_id); } return status; @@ -281,11 +281,11 @@ int32 OS_TaskGetInfo(osal_id_t task_id, OS_task_prop_t *task_prop) if (status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_TaskGetInfo), task_prop, sizeof(*task_prop)) < sizeof(*task_prop)) { - UT_ObjIdCompose(1, UT_OBJTYPE_TASK, &task_prop->creator); + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_TASK, &task_prop->creator); task_prop->stack_size = OSAL_SIZE_C(100); task_prop->priority = OSAL_PRIORITY_C(150); - strncpy(task_prop->name, "UnitTest", OS_MAX_API_NAME - 1); - task_prop->name[OS_MAX_API_NAME - 1] = '\0'; + strncpy(task_prop->name, "UnitTest", sizeof(task_prop->name) - 1); + task_prop->name[sizeof(task_prop->name) - 1] = '\0'; } return status; @@ -316,7 +316,7 @@ int32 OS_TaskFindIdBySystemData(osal_id_t *task_id, const void *sysdata, size_t if (status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_TaskFindIdBySystemData), task_id, sizeof(*task_id)) < sizeof(*task_id)) { - UT_ObjIdCompose(1, UT_OBJTYPE_TASK, task_id); + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_TASK, task_id); } return status; diff --git a/src/ut-stubs/osapi-utstub-time.c b/src/ut-stubs/osapi-utstub-time.c index 585463c67..e8478332a 100644 --- a/src/ut-stubs/osapi-utstub-time.c +++ b/src/ut-stubs/osapi-utstub-time.c @@ -57,7 +57,7 @@ int32 OS_TimerAdd(osal_id_t *timer_id, const char *timer_name, osal_id_t timebas if (status == OS_SUCCESS) { - *timer_id = UT_AllocStubObjId(UT_OBJTYPE_TIMECB); + *timer_id = UT_AllocStubObjId(OS_OBJECT_TYPE_OS_TIMECB); } else { @@ -86,7 +86,7 @@ int32 OS_TimerCreate(osal_id_t *timer_id, const char *timer_name, uint32 *clock_ if (status == OS_SUCCESS) { - *timer_id = UT_AllocStubObjId(UT_OBJTYPE_TIMECB); + *timer_id = UT_AllocStubObjId(OS_OBJECT_TYPE_OS_TIMECB); } else { @@ -139,7 +139,7 @@ int32 OS_TimerDelete(osal_id_t timer_id) if (status == OS_SUCCESS) { - UT_DeleteStubObjId(UT_OBJTYPE_TIMECB, timer_id); + UT_DeleteStubObjId(OS_OBJECT_TYPE_OS_TIMECB, timer_id); } return status; @@ -162,7 +162,7 @@ int32 OS_TimerGetIdByName(osal_id_t *timer_id, const char *timer_name) if (status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_TimerGetIdByName), timer_id, sizeof(*timer_id)) < sizeof(*timer_id)) { - UT_ObjIdCompose(1, UT_OBJTYPE_TIMECB, timer_id); + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_TIMECB, timer_id); } return status; @@ -200,7 +200,7 @@ int32 OS_TimerGetInfo(osal_id_t timer_id, OS_timer_prop_t *timer_prop) UT_Stub_CopyToLocal(UT_KEY(OS_TimerGetInfo), timer_prop, sizeof(*timer_prop)) < sizeof(*timer_prop)) { memset(timer_prop, 0, sizeof(*timer_prop)); - UT_ObjIdCompose(1, UT_OBJTYPE_TASK, &timer_prop->creator); + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_TASK, &timer_prop->creator); } return status; diff --git a/src/ut-stubs/osapi-utstub-timebase.c b/src/ut-stubs/osapi-utstub-timebase.c index 16b490479..b439eb1e0 100644 --- a/src/ut-stubs/osapi-utstub-timebase.c +++ b/src/ut-stubs/osapi-utstub-timebase.c @@ -54,7 +54,7 @@ int32 OS_TimeBaseCreate(osal_id_t *timebase_id, const char *timebase_name, OS_Ti if (status == OS_SUCCESS) { - *timebase_id = UT_AllocStubObjId(UT_OBJTYPE_TIMEBASE); + *timebase_id = UT_AllocStubObjId(OS_OBJECT_TYPE_OS_TIMEBASE); } else { @@ -97,7 +97,7 @@ int32 OS_TimeBaseDelete(osal_id_t timebase_id) if (status == OS_SUCCESS) { - UT_DeleteStubObjId(UT_OBJTYPE_TIMEBASE, timebase_id); + UT_DeleteStubObjId(OS_OBJECT_TYPE_OS_TIMEBASE, timebase_id); } return status; @@ -120,7 +120,7 @@ int32 OS_TimeBaseGetIdByName(osal_id_t *timebase_id, const char *timebase_name) if (status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_TimeBaseGetIdByName), timebase_id, sizeof(*timebase_id)) < sizeof(*timebase_id)) { - UT_ObjIdCompose(1, UT_OBJTYPE_TIMEBASE, timebase_id); + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_TIMEBASE, timebase_id); } return status; @@ -143,9 +143,9 @@ int32 OS_TimeBaseGetInfo(osal_id_t timebase_id, OS_timebase_prop_t *timebase_pro if (status == OS_SUCCESS && UT_Stub_CopyToLocal(UT_KEY(OS_TimeBaseGetInfo), timebase_prop, sizeof(*timebase_prop)) < sizeof(*timebase_prop)) { - UT_ObjIdCompose(1, UT_OBJTYPE_TASK, &timebase_prop->creator); - strncpy(timebase_prop->name, "Name", OS_MAX_API_NAME - 1); - timebase_prop->name[OS_MAX_API_NAME - 1] = '\0'; + UT_ObjIdCompose(1, OS_OBJECT_TYPE_OS_TASK, &timebase_prop->creator); + strncpy(timebase_prop->name, "Name", sizeof(timebase_prop->name) - 1); + timebase_prop->name[sizeof(timebase_prop->name) - 1] = '\0'; } return status; diff --git a/src/ut-stubs/utstub-helpers.c b/src/ut-stubs/utstub-helpers.c index 9d5c1824c..4050b2726 100644 --- a/src/ut-stubs/utstub-helpers.c +++ b/src/ut-stubs/utstub-helpers.c @@ -36,19 +36,19 @@ #include "osapi-idmap.h" -const uint32 UT_MAXOBJS[UT_OBJTYPE_MAX] = {[UT_OBJTYPE_TASK] = OS_MAX_TASKS, - [UT_OBJTYPE_QUEUE] = OS_MAX_QUEUES, - [UT_OBJTYPE_COUNTSEM] = OS_MAX_COUNT_SEMAPHORES, - [UT_OBJTYPE_BINSEM] = OS_MAX_BIN_SEMAPHORES, - [UT_OBJTYPE_MUTEX] = OS_MAX_MUTEXES, - [UT_OBJTYPE_TIMECB] = OS_MAX_TIMERS, - [UT_OBJTYPE_MODULE] = OS_MAX_MODULES, - [UT_OBJTYPE_FILESTREAM] = OS_MAX_NUM_OPEN_FILES, - [UT_OBJTYPE_TIMEBASE] = OS_MAX_TIMEBASES, - [UT_OBJTYPE_FILESYS] = OS_MAX_FILE_SYSTEMS, - [UT_OBJTYPE_DIR] = OS_MAX_NUM_OPEN_DIRS}; - -static UT_ObjTypeState_t UT_ObjState[UT_OBJTYPE_MAX]; +const uint32 UT_MAXOBJS[OS_OBJECT_TYPE_USER] = {[OS_OBJECT_TYPE_OS_TASK] = OS_MAX_TASKS, + [OS_OBJECT_TYPE_OS_QUEUE] = OS_MAX_QUEUES, + [OS_OBJECT_TYPE_OS_COUNTSEM] = OS_MAX_COUNT_SEMAPHORES, + [OS_OBJECT_TYPE_OS_BINSEM] = OS_MAX_BIN_SEMAPHORES, + [OS_OBJECT_TYPE_OS_MUTEX] = OS_MAX_MUTEXES, + [OS_OBJECT_TYPE_OS_TIMECB] = OS_MAX_TIMERS, + [OS_OBJECT_TYPE_OS_MODULE] = OS_MAX_MODULES, + [OS_OBJECT_TYPE_OS_STREAM] = OS_MAX_NUM_OPEN_FILES, + [OS_OBJECT_TYPE_OS_TIMEBASE] = OS_MAX_TIMEBASES, + [OS_OBJECT_TYPE_OS_FILESYS] = OS_MAX_FILE_SYSTEMS, + [OS_OBJECT_TYPE_OS_DIR] = OS_MAX_NUM_OPEN_DIRS}; + +static UT_ObjTypeState_t UT_ObjState[OS_OBJECT_TYPE_USER]; /** * Initialization function @@ -64,7 +64,7 @@ void UT_ClearAllStubObjects(void) /* * Helper function - "allocate" a fake object ID of the given type */ -osal_id_t UT_AllocStubObjId(UT_ObjType_t ObjType) +osal_id_t UT_AllocStubObjId(osal_objtype_t ObjType) { UT_ObjTypeState_t *StatePtr; uint8 ObjMask; @@ -73,7 +73,7 @@ osal_id_t UT_AllocStubObjId(UT_ObjType_t ObjType) UT_Stub_CallOnce(UT_ClearAllStubObjects); - if (ObjType == UT_OBJTYPE_NONE || ObjType >= UT_OBJTYPE_MAX) + if (ObjType == OS_OBJECT_TYPE_UNDEFINED || ObjType >= OS_OBJECT_TYPE_USER) { /* Code is broken, abort the test * (This signifies an error in the stub code itself hence the abort) @@ -115,11 +115,11 @@ osal_id_t UT_AllocStubObjId(UT_ObjType_t ObjType) /* * Helper function - "deallocate" a fake object ID of the given type */ -void UT_DeleteStubObjId(UT_ObjType_t ObjType, osal_id_t ObjId) +void UT_DeleteStubObjId(osal_objtype_t ObjType, osal_id_t ObjId) { UT_ObjTypeState_t *StatePtr; uint8 ObjMask; - UT_ObjType_t checktype; + osal_objtype_t checktype; uint32 checkidx; bool ObjWasValid; @@ -171,14 +171,14 @@ void UT_DeleteStubObjId(UT_ObjType_t ObjType, osal_id_t ObjId) } } -void UT_ObjIdCompose(uint32 indx, UT_ObjType_t objtype, osal_id_t *id) +void UT_ObjIdCompose(uint32 indx, osal_objtype_t objtype, osal_id_t *id) { /* note - the OS_ObjectIdFromInteger() is an inline function, * and therefore this uses the real thing and not a stub */ *id = OS_ObjectIdFromInteger((unsigned long)indx | ((0x4000UL | objtype) << 16)); } -void UT_ObjIdDecompose(osal_id_t id, uint32 *indx, UT_ObjType_t *objtype) +void UT_ObjIdDecompose(osal_id_t id, uint32 *indx, osal_objtype_t *objtype) { unsigned long idv = OS_ObjectIdToInteger(id); *indx = idv & 0xFFFFUL; diff --git a/src/ut-stubs/utstub-helpers.h b/src/ut-stubs/utstub-helpers.h index 6450aaeb5..8ac67a561 100644 --- a/src/ut-stubs/utstub-helpers.h +++ b/src/ut-stubs/utstub-helpers.h @@ -46,29 +46,12 @@ #include "common_types.h" #include "osapi-error.h" #include "osapi-constants.h" +#include "osapi-idmap.h" #include "utstubs.h" #include "utbsp.h" #include "utassert.h" #include "uttools.h" -typedef enum -{ - UT_OBJTYPE_NONE = 0, - UT_OBJTYPE_TASK, - UT_OBJTYPE_QUEUE, - UT_OBJTYPE_COUNTSEM, - UT_OBJTYPE_BINSEM, - UT_OBJTYPE_MUTEX, - UT_OBJTYPE_TIMECB, - UT_OBJTYPE_MODULE, - UT_OBJTYPE_FILESTREAM, - UT_OBJTYPE_SOCKET, - UT_OBJTYPE_TIMEBASE, - UT_OBJTYPE_DIR, - UT_OBJTYPE_FILESYS, - UT_OBJTYPE_MAX -} UT_ObjType_t; - /* * A constant to use in stubs where no other value is applicable */ @@ -100,12 +83,12 @@ extern const uint32 UT_MAXOBJS[]; /* * Helper function - "allocate" a fake object ID of the given type */ -osal_id_t UT_AllocStubObjId(UT_ObjType_t ObjType); +osal_id_t UT_AllocStubObjId(osal_objtype_t ObjType); /* * Helper function - "deallocate" a fake object ID of the given type */ -void UT_DeleteStubObjId(UT_ObjType_t ObjType, osal_id_t ObjId); +void UT_DeleteStubObjId(osal_objtype_t ObjType, osal_id_t ObjId); /* * Helper function - Clear all OSAL UT stub objects @@ -117,7 +100,7 @@ void UT_ClearAllStubObjects(void); * Compose/Decompose a unit test object ID from an index and type. * This is the UT-specific version not related to the OSAL runtime version. */ -void UT_ObjIdCompose(uint32 indx, UT_ObjType_t objtype, osal_id_t *id); -void UT_ObjIdDecompose(osal_id_t id, uint32 *indx, UT_ObjType_t *objtype); +void UT_ObjIdCompose(uint32 indx, osal_objtype_t objtype, osal_id_t *id); +void UT_ObjIdDecompose(osal_id_t id, uint32 *indx, osal_objtype_t *objtype); #endif diff --git a/ut_assert/inc/utassert.h b/ut_assert/inc/utassert.h index 08969e3bb..8bf875cf3 100644 --- a/ut_assert/inc/utassert.h +++ b/ut_assert/inc/utassert.h @@ -90,50 +90,49 @@ typedef struct #define UtAssert_True(Expression, ...) UtAssertEx(Expression, UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) /* Evaluates a expression as either true or false. true means the test passed, false means the test failed. */ -#define UtAssert_Bool(Expression, ...) \ - UtAssertEx(Expression, UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) +#define UtAssert_Bool(Expression, ...) UtAssertEx(Expression, UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) /* Asserts a test failure */ #define UtAssert_Failed(...) UtAssertEx(false, UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) /* Compares two integers and determines if they are equal within a specified absolute tolerance. */ -#define UtAssert_IntegerCmpAbs(x, y, Tolerance, ...) \ - UtAssertEx((abs((x) - (y)) <= (Tolerance)), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) +#define UtAssert_IntegerCmpAbs(x, y, Tolerance, ...) \ + UtAssertEx((abs((x) - (y)) <= (Tolerance)), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) /* Compares two floating point numbers and determines if they are equal within a specified absolute tolerance. */ -#define UtAssert_DoubleCmpAbs(x, y, Tolerance, ...) \ - UtAssertEx((fabs((x) - (y)) <= (Tolerance)), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) +#define UtAssert_DoubleCmpAbs(x, y, Tolerance, ...) \ + UtAssertEx((fabs((x) - (y)) <= (Tolerance)), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) /* Compares two floating point numbers and determines if they are equal within a specified relative tolerance. */ -#define UtAssert_DoubleCmpRel(x, y, Ratio, ...) \ - UtAssertEx((fabs((x) - (y))/(x) <= (Ratio)), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) +#define UtAssert_DoubleCmpRel(x, y, Ratio, ...) \ + UtAssertEx((fabs((x) - (y)) / (x) <= (Ratio)), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) /* Compares two strings and determines if they are equal. */ -#define UtAssert_StrCmp(String1, String2, ...) \ - UtAssertEx((strcmp(String1, String2) == 0), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) +#define UtAssert_StrCmp(String1, String2, ...) \ + UtAssertEx((strcmp(String1, String2) == 0), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) /* Compares at most Length characters of two strings and determines if they are equal. */ -#define UtAssert_StrnCmp(String1, String2, Length, ...) \ - UtAssertEx((strncmp(String1, String2, Length) == 0), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) +#define UtAssert_StrnCmp(String1, String2, Length, ...) \ + UtAssertEx((strncmp(String1, String2, Length) == 0), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) /* Compares two regions of memory and determines if they are equal. */ -#define UtAssert_MemCmp(Memory1, Memory2, Length, ...) \ - UtAssertEx((memcmp(Memory1, Memory2, Length) == 0), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) +#define UtAssert_MemCmp(Memory1, Memory2, Length, ...) \ + UtAssertEx((memcmp(Memory1, Memory2, Length) == 0), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) /* Compares a region of memory to a static pattern and determines if they are equal. Note: Use UtMemSet to * fill a region of memory with a static pattern. */ -#define UtAssert_MemCmpValue(Memory, Value, Length, ...) \ - UtAssertEx((UtMemCmpValue(Memory, Value, Length)), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) +#define UtAssert_MemCmpValue(Memory, Value, Length, ...) \ + UtAssertEx((UtMemCmpValue(Memory, Value, Length)), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) /* Compares a region of memory to a byte count pattern and determines if they are equal. Note: Use UtMemFill to * fill a region of memory with a byte count pattern. */ -#define UtAssert_MemCmpCount(Memory, Length, ...) \ - UtAssertEx((UtMemCmpCount(Memory, Length)), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) +#define UtAssert_MemCmpCount(Memory, Length, ...) \ + UtAssertEx((UtMemCmpCount(Memory, Length)), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) /* Compares a region of memory with the contents of a binary file and determines if they are equal. Note: Use * UtMem2BinFile to copy a region of memory to a binary file. */ -#define UtAssert_Mem2BinFileCmp(Memory, Filename, ...) \ - UtAssertEx((UtMem2BinFileCmp(Memory, Filename)), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) +#define UtAssert_Mem2BinFileCmp(Memory, Filename, ...) \ + UtAssertEx((UtMem2BinFileCmp(Memory, Filename)), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__) /* A wrapper around UtAssertEx that allows the user to specify the failure type and a more descriptive message */ #define UtAssert_Type(Type, Expression, ...) \ diff --git a/ut_assert/inc/utbsp.h b/ut_assert/inc/utbsp.h index 109e94ce6..27de86013 100644 --- a/ut_assert/inc/utbsp.h +++ b/ut_assert/inc/utbsp.h @@ -100,4 +100,4 @@ void UT_BSP_DoText(uint8 MessageType, const char *OutputMessage); */ void UT_BSP_EndTest(const UtAssert_TestCounter_t *TestCounters); -#endif /* UTBSP_H */ +#endif /* UTBSP_H */ diff --git a/ut_assert/inc/utstubs.h b/ut_assert/inc/utstubs.h index 7c532ec6f..ad7601218 100644 --- a/ut_assert/inc/utstubs.h +++ b/ut_assert/inc/utstubs.h @@ -209,7 +209,7 @@ void UT_ClearDefaultReturnValue(UT_EntryKey_t FuncKey); * * \param FuncKey The stub function to add the return code to. * \param Value Arbitrary failure mode value (may or may not be used by the stub) - * + * * @deprecated replaced by UT_SetDefaultReturnValue */ void UT_SetForceFail(UT_EntryKey_t FuncKey, int32 Value); @@ -220,7 +220,7 @@ void UT_SetForceFail(UT_EntryKey_t FuncKey, int32 Value); * This undoes the action of UT_SetDefaultReturnValue() * * \param FuncKey The stub function entry to clear. - * + * * @deprecated replaced by UT_ClearDefaultReturnValue */ void UT_ClearForceFail(UT_EntryKey_t FuncKey); @@ -463,8 +463,15 @@ int32 UT_DefaultStubImpl(const char *FunctionName, UT_EntryKey_t FuncKey, int32 * * This version should be used on stubs that take no arguments * and are expected to return 0 in the nominal case + * + * NOTE - Adding a NULL to the va list is only done for the + * two macros that do not have a va list passed in by the + * caller and is NOT a general pattern. Hooks that handle + * va lists should utilize the UT_KEY to process + * va lists correctly based on the implementation (no + * general pattern should be assumed). */ -#define UT_DEFAULT_IMPL(FuncName) UT_DefaultStubImpl(#FuncName, UT_KEY(FuncName), 0) +#define UT_DEFAULT_IMPL(FuncName) UT_DefaultStubImpl(#FuncName, UT_KEY(FuncName), 0, NULL) /** * Macro to simplify usage of the UT_DefaultStubImpl() function @@ -475,8 +482,15 @@ int32 UT_DefaultStubImpl(const char *FunctionName, UT_EntryKey_t FuncKey, int32 * * This version should be used on stubs that take no arguments * and are expected to return nonzero in the nominal case + * + * NOTE - Adding a NULL to the va list is only done for the + * two macros that do not have a va list passed in by the + * caller and is NOT a general pattern. Hooks that handle + * va lists should utilize the UT_KEY to process + * va lists correctly based on the implementation (no + * general pattern should be assumed). */ -#define UT_DEFAULT_IMPL_RC(FuncName, Rc) UT_DefaultStubImpl(#FuncName, UT_KEY(FuncName), Rc) +#define UT_DEFAULT_IMPL_RC(FuncName, Rc) UT_DefaultStubImpl(#FuncName, UT_KEY(FuncName), Rc, NULL) /** * Macro to simplify usage of the UT_DefaultStubImpl() function @@ -526,4 +540,4 @@ int32 UT_DefaultStubImpl(const char *FunctionName, UT_EntryKey_t FuncKey, int32 return UT_DEFAULT_IMPL(FuncName); \ } -#endif /* UTSTUBS_H */ +#endif /* UTSTUBS_H */ diff --git a/ut_assert/src/utbsp.c b/ut_assert/src/utbsp.c index 11b508efb..3de0efae4 100644 --- a/ut_assert/src/utbsp.c +++ b/ut_assert/src/utbsp.c @@ -133,7 +133,7 @@ void UT_BSP_DoText(uint8 MessageType, const char *OutputMessage) break; case UTASSERT_CASETYPE_TTF: TermModeBits = OS_BSP_CONSOLEMODE_HIGHLIGHT | OS_BSP_CONSOLEMODE_RED | OS_BSP_CONSOLEMODE_BLUE; - Prefix = "TTF"; + Prefix = "TTF"; break; case UTASSERT_CASETYPE_NA: Prefix = "N/A"; diff --git a/ut_assert/src/utglobal.h b/ut_assert/src/utglobal.h index 7664a3415..cc0c08e4c 100644 --- a/ut_assert/src/utglobal.h +++ b/ut_assert/src/utglobal.h @@ -64,4 +64,4 @@ typedef struct */ extern UtAssert_Global_t UtAssert_Global; -#endif /* UTASSERT_GLOBAL_H */ +#endif /* UTASSERT_GLOBAL_H */