Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build Check
on:
push:
pull_request:
workflow_dispatch:

env:
bashPass: \033[32;1mPASSED -
bashWarn: \033[33;1mWARNING -
bashFail: \033[31;1mFAILED -
bashEnd: \033[0m

jobs:
BUILD-CHECK:
name: Build Check
runs-on: ubuntu-latest
steps:
- env:
stepName: Checkout Repository
name: ${{ env.stepName }}
uses: actions/checkout@v4

- env:
stepName: Install Tools
name: ${{ env.stepName }}
shell: bash
run: |
# ${{ env.stepName }}
echo -e "::group::${{ env.stepName }}"
set +e
sudo apt-get -y update
sudo apt-get -y install build-essential
exitStatus=$?
set -e
echo -e "::endgroup::"
if [ $exitStatus -eq 0 ]; then
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
else
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
exit 1
fi

- env:
stepName: Build
name: ${{ env.stepName }}
id: build-test
shell: bash
working-directory: test/posix_build_test
run: |
# ${{ env.stepName }}
echo -e "::group::${{ env.stepName }}"
set +e
cmake -S . -B build
make -C build -j
exitStatus=$?
set -e
echo -e "::endgroup::"
if [ $exitStatus -eq 0 ]; then
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
else
echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
exit 1
fi
12 changes: 10 additions & 2 deletions FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ int clock_settime( clockid_t clock_id,

/* This function is currently unsupported. It will always return -1 and
* set errno to EPERM. */
errno = EPERM;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = EPERM;
}
#endif

return -1;
}
Expand All @@ -221,7 +225,11 @@ int nanosleep( const struct timespec * rqtp,
/* Check rqtp. */
if( UTILS_ValidateTimespec( rqtp ) == false )
{
errno = EINVAL;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = EINVAL;
}
#endif
iStatus = -1;
}

Expand Down
126 changes: 105 additions & 21 deletions FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_mqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,11 @@ int mq_close( mqd_t mqdes )
else
{
/* Queue not found; bad descriptor. */
errno = EBADF;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = EBADF;
}
#endif
iStatus = -1;
}

Expand Down Expand Up @@ -479,7 +483,11 @@ int mq_getattr( mqd_t mqdes,
else
{
/* Queue not found; bad descriptor. */
errno = EBADF;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = EBADF;
}
#endif
iStatus = -1;
}

Expand Down Expand Up @@ -518,7 +526,11 @@ mqd_t mq_open( const char * name,
if( prvValidateQueueName( name, &xNameLength ) == pdFALSE )
{
/* Invalid name. */
errno = EINVAL;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = EINVAL;
}
#endif
xMessageQueue = ( mqd_t ) -1;
}

Expand All @@ -528,7 +540,11 @@ mqd_t mq_open( const char * name,
if( ( oflag & O_CREAT ) && ( attr != NULL ) && ( ( attr->mq_maxmsg <= 0 ) || ( attr->mq_msgsize <= 0 ) ) )
{
/* Invalid mq_attr.mq_maxmsg or mq_attr.mq_msgsize. */
errno = EINVAL;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = EINVAL;
}
#endif
xMessageQueue = ( mqd_t ) -1;
}
}
Expand All @@ -548,7 +564,11 @@ mqd_t mq_open( const char * name,
* O_CREAT and O_EXCL. */
if( ( oflag & O_EXCL ) && ( oflag & O_CREAT ) )
{
errno = EEXIST;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = EEXIST;
}
#endif
xMessageQueue = ( mqd_t ) -1;
}
else
Expand All @@ -557,7 +577,11 @@ mqd_t mq_open( const char * name,
if( ( ( QueueListElement_t * ) xMessageQueue )->xPendingUnlink == pdTRUE )
{
/* Queue pending deletion. Don't allow it to be re-opened. */
errno = EINVAL;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = EINVAL;
}
#endif
xMessageQueue = ( mqd_t ) -1;
}
else
Expand Down Expand Up @@ -588,13 +612,21 @@ mqd_t mq_open( const char * name,
name,
xNameLength ) == pdFALSE )
{
errno = ENOSPC;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = ENOSPC;
}
#endif
xMessageQueue = ( mqd_t ) -1;
}
}
else
{
errno = ENOENT;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = ENOENT;
}
#endif
xMessageQueue = ( mqd_t ) -1;
}
}
Expand Down Expand Up @@ -651,7 +683,11 @@ ssize_t mq_timedreceive( mqd_t mqdes,
if( prvFindQueueInList( NULL, NULL, mqdes ) == pdFALSE )
{
/* Queue not found; bad descriptor. */
errno = EBADF;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = EBADF;
}
#endif
xStatus = -1;
}

Expand All @@ -661,7 +697,11 @@ ssize_t mq_timedreceive( mqd_t mqdes,
if( msg_len < ( size_t ) pxMessageQueue->xAttr.mq_msgsize )
{
/* msg_len too small. */
errno = EMSGSIZE;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = EMSGSIZE;
}
#endif
xStatus = -1;
}
}
Expand All @@ -675,7 +715,11 @@ ssize_t mq_timedreceive( mqd_t mqdes,

if( iCalculateTimeoutReturn != 0 )
{
errno = iCalculateTimeoutReturn;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = iCalculateTimeoutReturn;
}
#endif
xStatus = -1;
}
}
Expand All @@ -694,12 +738,20 @@ ssize_t mq_timedreceive( mqd_t mqdes,
if( pxMessageQueue->xAttr.mq_flags & O_NONBLOCK )
{
/* Set errno to EAGAIN for nonblocking mq. */
errno = EAGAIN;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = EAGAIN;
}
#endif
}
else
{
/* Otherwise, set errno to ETIMEDOUT. */
errno = ETIMEDOUT;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = ETIMEDOUT;
}
#endif
}

xStatus = -1;
Expand Down Expand Up @@ -743,7 +795,11 @@ int mq_timedsend( mqd_t mqdes,
if( prvFindQueueInList( NULL, NULL, mqdes ) == pdFALSE )
{
/* Queue not found; bad descriptor. */
errno = EBADF;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = EBADF;
}
#endif
iStatus = -1;
}

Expand All @@ -753,7 +809,11 @@ int mq_timedsend( mqd_t mqdes,
if( msg_len > ( size_t ) pxMessageQueue->xAttr.mq_msgsize )
{
/* msg_len too large. */
errno = EMSGSIZE;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = EMSGSIZE;
}
#endif
iStatus = -1;
}
}
Expand All @@ -767,7 +827,11 @@ int mq_timedsend( mqd_t mqdes,

if( iCalculateTimeoutReturn != 0 )
{
errno = iCalculateTimeoutReturn;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = iCalculateTimeoutReturn;
}
#endif
iStatus = -1;
}
}
Expand All @@ -785,7 +849,11 @@ int mq_timedsend( mqd_t mqdes,
if( xSendData.pcData == NULL )
{
/* msg_len too large. */
errno = EMSGSIZE;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = EMSGSIZE;
}
#endif
iStatus = -1;
}
else
Expand All @@ -806,12 +874,20 @@ int mq_timedsend( mqd_t mqdes,
if( pxMessageQueue->xAttr.mq_flags & O_NONBLOCK )
{
/* Set errno to EAGAIN for nonblocking mq. */
errno = EAGAIN;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = EAGAIN;
}
#endif
}
else
{
/* Otherwise, set errno to ETIMEDOUT. */
errno = ETIMEDOUT;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = ETIMEDOUT;
}
#endif
}

/* Free the allocated queue data. */
Expand Down Expand Up @@ -840,7 +916,11 @@ int mq_unlink( const char * name )
if( prvValidateQueueName( name, &xNameSize ) == pdFALSE )
{
/* Error with mq name. */
errno = EINVAL;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = EINVAL;
}
#endif
iStatus = -1;
}

Expand Down Expand Up @@ -873,7 +953,11 @@ int mq_unlink( const char * name )
else
{
/* The named message queue doesn't exist. */
errno = ENOENT;
#if ( configUSE_POSIX_ERRNO == 1 )
{
errno = ENOENT;
}
#endif
iStatus = -1;
}

Expand Down
Loading