Skip to content

Commit

Permalink
Merge pull request #666 from jphickey/fix-648-649-664
Browse files Browse the repository at this point in the history
Fix #648, 649, 664 - refactor all table array access
  • Loading branch information
astrogeco authored Dec 9, 2020
2 parents 77300fd + ba3bc01 commit 5c61560
Show file tree
Hide file tree
Showing 130 changed files with 3,753 additions and 2,514 deletions.
4 changes: 2 additions & 2 deletions src/os/inc/osapi-os-timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
/*
** Typedefs
*/
typedef void (*OS_TimerCallback_t)(osal_id_t timer_id); /**< @brief Timer callback */
typedef uint32 (*OS_TimerSync_t)(osal_index_t timer_id); /**< @brief Timer sync */
typedef void (*OS_TimerCallback_t)(osal_id_t timer_id); /**< @brief Timer callback */
typedef uint32 (*OS_TimerSync_t)(osal_id_t timer_id); /**< @brief Timer sync */

/** @brief Timer properties */
typedef struct
Expand Down
24 changes: 14 additions & 10 deletions src/os/portable/os-impl-bsd-select.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <osapi.h>
#include "os-impl-select.h"
#include "os-shared-select.h"
#include "os-shared-idmap.h"

/****************************************************************************************
DEFINES
Expand Down Expand Up @@ -249,17 +250,20 @@ static int32 OS_DoSelect(int maxfd, fd_set *rd_set, fd_set *wr_set, int32 msecs)
* See prototype for argument/return detail
*
*-----------------------------------------------------------------*/
int32 OS_SelectSingle_Impl(osal_index_t stream_id, uint32 *SelectFlags, int32 msecs)
int32 OS_SelectSingle_Impl(const OS_object_token_t *token, uint32 *SelectFlags, int32 msecs)
{
int32 return_code;
fd_set wr_set;
fd_set rd_set;
int32 return_code;
fd_set wr_set;
fd_set rd_set;
OS_impl_file_internal_record_t *impl;

impl = OS_OBJECT_TABLE_GET(OS_impl_filehandle_table, *token);

/*
* If called on a stream_id which does not support this
* operation, return immediately and do not invoke the system call
*/
if (!OS_impl_filehandle_table[stream_id].selectable)
if (!impl->selectable)
{
return OS_ERR_OPERATION_NOT_SUPPORTED;
}
Expand All @@ -270,22 +274,22 @@ int32 OS_SelectSingle_Impl(osal_index_t stream_id, uint32 *SelectFlags, int32 ms
FD_ZERO(&rd_set);
if (*SelectFlags & OS_STREAM_STATE_READABLE)
{
FD_SET(OS_impl_filehandle_table[stream_id].fd, &rd_set);
FD_SET(impl->fd, &rd_set);
}
if (*SelectFlags & OS_STREAM_STATE_WRITABLE)
{
FD_SET(OS_impl_filehandle_table[stream_id].fd, &wr_set);
FD_SET(impl->fd, &wr_set);
}

return_code = OS_DoSelect(OS_impl_filehandle_table[stream_id].fd, &rd_set, &wr_set, msecs);
return_code = OS_DoSelect(impl->fd, &rd_set, &wr_set, msecs);

if (return_code == OS_SUCCESS)
{
if (!FD_ISSET(OS_impl_filehandle_table[stream_id].fd, &rd_set))
if (!FD_ISSET(impl->fd, &rd_set))
{
*SelectFlags &= ~OS_STREAM_STATE_READABLE;
}
if (!FD_ISSET(OS_impl_filehandle_table[stream_id].fd, &wr_set))
if (!FD_ISSET(impl->fd, &wr_set))
{
*SelectFlags &= ~OS_STREAM_STATE_WRITABLE;
}
Expand Down
Loading

0 comments on commit 5c61560

Please sign in to comment.