Rearrange and fixup abstraction layer
- Replace os_result by dds_retcode_t and move DDS return code defines down. Eliminates the need to convert between different return code types. - Move dds_time_t down and remove os_time. Eliminates the need to convert between different time representations and reduces code duplication. - Remove use of Microsoft source-code annotation language (SAL). SAL annotations are Microsoft specific and not very well documented. This makes it very difficult for contributers to write. - Rearrange the abstraction layer to be feature-based. The previous layout falsely assumed that the operating system dictates which implementation is best suited. For general purpose operating systems this is mostly true, but embedded targets require a slightly different approach and may not even offer all features. The new layout makes it possible to mix-and-match feature implementations and allows for features to not be implemented at all. - Replace the os prefix by ddsrt to avoid name collisions. - Remove various portions of unused and unwanted code. - Export thread names on all supported platforms. - Return native thread identifier on POSIX compatible platforms. - Add timed wait for condition variables that takes an absolute time. - Remove system abstraction for errno. The os_getErrno and os_setErrno were incorrect. Functions that might fail now simply return a DDS return code instead. - Remove thread-specific memory abstraction. os_threadMemGet and accompanying functions were a mess and their use has been eliminated by other changes in this commit. - Replace attribute (re)defines by ddsrt_ prefixed equivalents to avoid name collisions and problems with faulty __nonnull__ attributes. Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
This commit is contained in:
parent
318968f40f
commit
cd6742ee12
439 changed files with 22117 additions and 28782 deletions
|
@ -10,10 +10,7 @@
|
|||
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||
#
|
||||
add_executable(ddsls ddsls.c)
|
||||
target_link_libraries(ddsls ddsc OSAPI)
|
||||
if(WIN32)
|
||||
target_compile_definitions(ddsls PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
target_link_libraries(ddsls ddsc)
|
||||
|
||||
install(
|
||||
TARGETS ddsls
|
||||
|
|
|
@ -9,11 +9,16 @@
|
|||
*
|
||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||
*/
|
||||
#include "os/os.h"
|
||||
#include "ddsc/dds.h"
|
||||
#include <getopt.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "dds/ddsrt/misc.h"
|
||||
#include "dds/ddsrt/string.h"
|
||||
#include "dds/dds.h"
|
||||
|
||||
// FIXME Temporary workaround for lack of wait_for_historical implementation. Remove this on completion of CHAM-268.
|
||||
#define dds_reader_wait_for_historical_data(a,b) DDS_SUCCESS; dds_sleepfor(DDS_MSECS(200));
|
||||
#define dds_reader_wait_for_historical_data(a,b) DDS_RETCODE_OK; dds_sleepfor(DDS_MSECS(200));
|
||||
|
||||
// FIXME should fix read/take interface to allow simple unlimited take
|
||||
#define MAX_SAMPLES 10
|
||||
|
@ -517,13 +522,15 @@ int main (int argc, char **argv)
|
|||
int flags = 0;
|
||||
dds_entity_t pp;
|
||||
int opt;
|
||||
while ((opt = os_getopt (argc, argv, "f:a")) != EOF)
|
||||
while ((opt = getopt (argc, argv, "f:a")) != EOF)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'f': {
|
||||
char *fname = os_get_optarg ();
|
||||
char *fname = optarg;
|
||||
DDSRT_WARNING_MSVC_OFF(4996)
|
||||
fp = fopen (fname, "w");
|
||||
DDSRT_WARNING_MSVC_ON(4996)
|
||||
if (fp == NULL)
|
||||
{
|
||||
fprintf (stderr, "%s: can't open for writing\n", fname);
|
||||
|
@ -545,12 +552,12 @@ int main (int argc, char **argv)
|
|||
usage();
|
||||
}
|
||||
|
||||
for (int i = os_get_optind (); i < argc; i++)
|
||||
for (int i = optind; i < argc; i++)
|
||||
{
|
||||
size_t k;
|
||||
for (k = 0; k < TOPICTAB_SIZE; k++)
|
||||
{
|
||||
if (os_strcasecmp (argv[i], topictab[k].name) == 0)
|
||||
if (ddsrt_strcasecmp (argv[i], topictab[k].name) == 0)
|
||||
{
|
||||
flags |= topictab[k].flag;
|
||||
break;
|
||||
|
@ -565,7 +572,7 @@ int main (int argc, char **argv)
|
|||
|
||||
if ((pp = dds_create_participant (DDS_DOMAIN_DEFAULT, NULL, NULL)) < 0)
|
||||
{
|
||||
fprintf (stderr, "failed to create participant: %s\n", dds_err_str (pp));
|
||||
fprintf (stderr, "failed to create participant: %s\n", dds_strretcode (pp));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue