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
2 changes: 1 addition & 1 deletion Bdd/Targets/Common/BddTargetFreeRtosPipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ void BddTargetFreeRtosPipeline_InteractiveTask(void* argument)
atomicCounter = SolidSyslogStdAtomicCounter_Create();
struct SolidSyslogMetaSdConfig metaConfig = {
.Counter = atomicCounter,
.GetSysUpTime = SolidSyslogFreeRtosSysUpTime_Get,
.GetSysUpTime = SolidSyslogFreeRtos_GetSysUpTime,
.GetLanguage = BddTargetLanguage_Get,
};
metaSd = SolidSyslogMetaSd_Create(&metaConfig);
Expand Down
2 changes: 1 addition & 1 deletion Bdd/Targets/Common/BddTargetTlsSender_OpenSsl_PosixTcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct SolidSyslogSender* BddTargetTlsSender_Create(struct SolidSyslogResolver*
static struct SolidSyslogOpenSslStreamConfig tlsStreamConfig;
tlsStreamConfig = (struct SolidSyslogOpenSslStreamConfig) {0};
tlsStreamConfig.Transport = underlyingStream;
tlsStreamConfig.Sleep = SolidSyslogPosixSleep;
tlsStreamConfig.Sleep = SolidSyslogPosix_Sleep;
if (mtls)
{
tlsStreamConfig.CaBundlePath = BddTargetMtlsConfig_GetCaBundlePath();
Expand Down
2 changes: 1 addition & 1 deletion Bdd/Targets/Common/BddTargetTlsSender_OpenSsl_WinsockTcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct SolidSyslogSender* BddTargetTlsSender_Create(struct SolidSyslogResolver*
static struct SolidSyslogOpenSslStreamConfig tlsStreamConfig;
tlsStreamConfig = (struct SolidSyslogOpenSslStreamConfig) {0};
tlsStreamConfig.Transport = underlyingStream;
tlsStreamConfig.Sleep = SolidSyslogWindowsSleep;
tlsStreamConfig.Sleep = SolidSyslogWindows_Sleep;
if (mtls)
{
tlsStreamConfig.CaBundlePath = BddTargetMtlsConfig_GetCaBundlePath();
Expand Down
10 changes: 5 additions & 5 deletions Bdd/Targets/Linux/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ static struct SolidSyslog* solidSyslog;
static void* ServiceThreadEntry(void* arg)
{
volatile bool* shutdown = (volatile bool*) arg;
BddTargetServiceThread_Run(solidSyslog, shutdown, SolidSyslogPosixSleep);
BddTargetServiceThread_Run(solidSyslog, shutdown, SolidSyslogPosix_Sleep);
return NULL;
}

Expand Down Expand Up @@ -314,7 +314,7 @@ int main(int argc, char* argv[])
struct SolidSyslogAtomicCounter* counter = SolidSyslogStdAtomicCounter_Create();
struct SolidSyslogMetaSdConfig metaConfig = {
.Counter = counter,
.GetSysUpTime = SolidSyslogPosixSysUpTime_Get,
.GetSysUpTime = SolidSyslogPosix_GetSysUpTime,
.GetLanguage = BddTargetLanguage_Get,
};
struct SolidSyslogStructuredData* metaSd = SolidSyslogMetaSd_Create(&metaConfig);
Expand All @@ -335,10 +335,10 @@ int main(int argc, char* argv[])
struct SolidSyslogConfig config = {
.Buffer = buffer,
.Sender = sender,
.Clock = SolidSyslogPosixClock_GetTimestamp,
.GetHostname = SolidSyslogPosixHostname_Get,
.Clock = SolidSyslogPosix_GetTimestamp,
.GetHostname = SolidSyslogPosix_GetHostname,
.GetAppName = BddTargetAppName_Get,
.GetProcessId = SolidSyslogPosixProcessId_Get,
.GetProcessId = SolidSyslogPosix_GetProcessId,
.Store = store,
.Sd = sdList,
.SdCount = sdCount,
Expand Down
10 changes: 5 additions & 5 deletions Bdd/Targets/Windows/BddTargetWindows.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static struct SolidSyslogSecurityPolicy* securityPolicy;
// NOLINTNEXTLINE(readability-non-const-parameter) -- _beginthreadex thread-entry signature requires void*
static unsigned __stdcall ServiceThreadEntry(void* arg)
{
BddTargetServiceThread_Run(solidSyslog, (volatile bool*) arg, SolidSyslogWindowsSleep);
BddTargetServiceThread_Run(solidSyslog, (volatile bool*) arg, SolidSyslogWindows_Sleep);
return 0;
}

Expand Down Expand Up @@ -371,7 +371,7 @@ int BddTargetWindows_Run(int argc, char* argv[])
struct SolidSyslogAtomicCounter* counter = SolidSyslogWindowsAtomicCounter_Create();
struct SolidSyslogMetaSdConfig metaConfig = {
.Counter = counter,
.GetSysUpTime = SolidSyslogWindowsSysUpTime_Get,
.GetSysUpTime = SolidSyslogWindows_GetSysUpTime,
.GetLanguage = BddTargetLanguage_Get,
};
struct SolidSyslogStructuredData* metaSd = SolidSyslogMetaSd_Create(&metaConfig);
Expand All @@ -395,10 +395,10 @@ int BddTargetWindows_Run(int argc, char* argv[])
struct SolidSyslogConfig config = {
.Buffer = buffer,
.Sender = sender,
.Clock = SolidSyslogWindowsClock_GetTimestamp,
.GetHostname = SolidSyslogWindowsHostname_Get,
.Clock = SolidSyslogWindows_GetTimestamp,
.GetHostname = SolidSyslogWindows_GetHostname,
.GetAppName = BddTargetAppName_Get,
.GetProcessId = SolidSyslogWindowsProcessId_Get,
.GetProcessId = SolidSyslogWindows_GetProcessId,
.Store = store,
.Sd = sdList,
.SdCount = sdCount,
Expand Down
2 changes: 1 addition & 1 deletion Platform/FreeRtos/Interface/SolidSyslogFreeRtosSysUpTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ SOLIDSYSLOG_EXTERN_C_BEGIN
* A 16-bit tick counter, or a 32-bit rate that does not divide 100
* (including any rate above 100 Hz), fails to build (widen the tick type,
* pick a dividing rate, or supply your own SolidSyslogSysUpTimeFunction). */
uint32_t SolidSyslogFreeRtosSysUpTime_Get(void);
uint32_t SolidSyslogFreeRtos_GetSysUpTime(void);

SOLIDSYSLOG_EXTERN_C_END

Expand Down
2 changes: 1 addition & 1 deletion Platform/FreeRtos/Source/SolidSyslogFreeRtosSysUpTime.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SOLIDSYSLOG_STATIC_ASSERT(
"SolidSyslogSysUpTimeFunction."
);

uint32_t SolidSyslogFreeRtosSysUpTime_Get(void)
uint32_t SolidSyslogFreeRtos_GetSysUpTime(void)
{
/* Divide the tick count down before scaling by 100 so the intermediate
* cannot overflow even a 64-bit TickType_t; the whole/remainder split is
Expand Down
2 changes: 1 addition & 1 deletion Platform/Posix/Interface/SolidSyslogPosixClock.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct SolidSyslogTimestamp;
SOLIDSYSLOG_EXTERN_C_BEGIN

/** Fills @p timestamp from the system real-time clock (CLOCK_REALTIME). */
void SolidSyslogPosixClock_GetTimestamp(struct SolidSyslogTimestamp * timestamp);
void SolidSyslogPosix_GetTimestamp(struct SolidSyslogTimestamp * timestamp);

SOLIDSYSLOG_EXTERN_C_END

Expand Down
2 changes: 1 addition & 1 deletion Platform/Posix/Interface/SolidSyslogPosixHostname.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct SolidSyslogHeaderField;
SOLIDSYSLOG_EXTERN_C_BEGIN

/** Writes the host's name (gethostname) into @p field. @p context is unused. */
void SolidSyslogPosixHostname_Get(struct SolidSyslogHeaderField * field, void* context);
void SolidSyslogPosix_GetHostname(struct SolidSyslogHeaderField * field, void* context);

SOLIDSYSLOG_EXTERN_C_END

Expand Down
2 changes: 1 addition & 1 deletion Platform/Posix/Interface/SolidSyslogPosixProcessId.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct SolidSyslogHeaderField;
SOLIDSYSLOG_EXTERN_C_BEGIN

/** Writes the process id (getpid) into @p field. @p context is unused. */
void SolidSyslogPosixProcessId_Get(struct SolidSyslogHeaderField * field, void* context);
void SolidSyslogPosix_GetProcessId(struct SolidSyslogHeaderField * field, void* context);

SOLIDSYSLOG_EXTERN_C_END

Expand Down
2 changes: 1 addition & 1 deletion Platform/Posix/Interface/SolidSyslogPosixSleep.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SOLIDSYSLOG_EXTERN_C_BEGIN
/** Sleeps for @p milliseconds via nanosleep. It neither performs nor bounds
* retries; callers such as the TLS handshake use it to yield between their own
* bounded attempts. */
void SolidSyslogPosixSleep(int milliseconds);
void SolidSyslogPosix_Sleep(int milliseconds);

SOLIDSYSLOG_EXTERN_C_END

Expand Down
2 changes: 1 addition & 1 deletion Platform/Posix/Interface/SolidSyslogPosixSysUpTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SOLIDSYSLOG_EXTERN_C_BEGIN
/** Hundredths of a second since boot from CLOCK_BOOTTIME, as RFC 3418
* sysUpTime; wraps modulo 2^32 per the TimeTicks contract. Returns 0 if the
* clock read fails. */
uint32_t SolidSyslogPosixSysUpTime_Get(void);
uint32_t SolidSyslogPosix_GetSysUpTime(void);

SOLIDSYSLOG_EXTERN_C_END

Expand Down
2 changes: 1 addition & 1 deletion Platform/Posix/Source/SolidSyslogPosixClock.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static inline void PosixClock_PopulateTimestamp(
const struct tm* breakdown
);

void SolidSyslogPosixClock_GetTimestamp(struct SolidSyslogTimestamp* timestamp)
void SolidSyslogPosix_GetTimestamp(struct SolidSyslogTimestamp* timestamp)
{
struct timespec now;
struct tm breakdown;
Expand Down
2 changes: 1 addition & 1 deletion Platform/Posix/Source/SolidSyslogPosixHostname.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ enum
MAX_HOSTNAME_SIZE = 256U
};

void SolidSyslogPosixHostname_Get(struct SolidSyslogHeaderField* field, void* context)
void SolidSyslogPosix_GetHostname(struct SolidSyslogHeaderField* field, void* context)
{
char hostname[MAX_HOSTNAME_SIZE];

Expand Down
2 changes: 1 addition & 1 deletion Platform/Posix/Source/SolidSyslogPosixProcessId.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

struct SolidSyslogHeaderField;

void SolidSyslogPosixProcessId_Get(struct SolidSyslogHeaderField* field, void* context)
void SolidSyslogPosix_GetProcessId(struct SolidSyslogHeaderField* field, void* context)
{
(void) context;
SolidSyslogHeaderField_Uint32(field, (uint32_t) getpid());
Expand Down
2 changes: 1 addition & 1 deletion Platform/Posix/Source/SolidSyslogPosixSleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ enum
NANOSECONDS_PER_MILLISECOND = 1000000L
};

void SolidSyslogPosixSleep(int milliseconds)
void SolidSyslogPosix_Sleep(int milliseconds)
{
struct timespec ts = {
.tv_sec = milliseconds / MILLISECONDS_PER_SECOND,
Expand Down
2 changes: 1 addition & 1 deletion Platform/Posix/Source/SolidSyslogPosixSysUpTime.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ enum
NANOSECONDS_PER_HUNDREDTH = 10000000
};

uint32_t SolidSyslogPosixSysUpTime_Get(void)
uint32_t SolidSyslogPosix_GetSysUpTime(void)
{
struct timespec now;
uint32_t result = 0;
Expand Down
2 changes: 1 addition & 1 deletion Platform/Windows/Interface/SolidSyslogWindowsClock.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SOLIDSYSLOG_EXTERN_C_BEGIN

/** Fills @p timestamp from the system wall clock (GetSystemTimeAsFileTime),
* broken down to UTC calendar fields with microsecond precision. */
void SolidSyslogWindowsClock_GetTimestamp(struct SolidSyslogTimestamp * timestamp);
void SolidSyslogWindows_GetTimestamp(struct SolidSyslogTimestamp * timestamp);

SOLIDSYSLOG_EXTERN_C_END

Expand Down
4 changes: 3 additions & 1 deletion Platform/Windows/Interface/SolidSyslogWindowsFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
* or Store.
*
* Files open in binary mode (_O_BINARY) so the CRT's CR/LF translation never
* corrupts arbitrary bytes — BlockStore frames round-trip unchanged. */
* corrupts arbitrary bytes — BlockStore frames round-trip unchanged. A write is
* not flushed to the medium, so durability past a power cut belongs to the
* volume rather than to this adapter. */
#ifndef SOLIDSYSLOGWINDOWSFILE_H
#define SOLIDSYSLOGWINDOWSFILE_H

Expand Down
2 changes: 1 addition & 1 deletion Platform/Windows/Interface/SolidSyslogWindowsHostname.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SOLIDSYSLOG_EXTERN_C_BEGIN

/** Writes the physical DNS host name (GetComputerNameExA) into @p field.
* @p context is unused. */
void SolidSyslogWindowsHostname_Get(struct SolidSyslogHeaderField * field, void* context);
void SolidSyslogWindows_GetHostname(struct SolidSyslogHeaderField * field, void* context);

SOLIDSYSLOG_EXTERN_C_END

Expand Down
2 changes: 1 addition & 1 deletion Platform/Windows/Interface/SolidSyslogWindowsProcessId.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SOLIDSYSLOG_EXTERN_C_BEGIN

/** Writes the process id (GetCurrentProcessId) into @p field. @p context is
* unused. */
void SolidSyslogWindowsProcessId_Get(struct SolidSyslogHeaderField * field, void* context);
void SolidSyslogWindows_GetProcessId(struct SolidSyslogHeaderField * field, void* context);

SOLIDSYSLOG_EXTERN_C_END

Expand Down
5 changes: 3 additions & 2 deletions Platform/Windows/Interface/SolidSyslogWindowsSleep.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @file
* The Windows SolidSyslogSleepFunction. */
* The Windows SolidSyslogSleepFunction, for the bounded waits a TLS handshake
* or a name-resolution spin needs. */
#ifndef SOLIDSYSLOGWINDOWSSLEEP_H
#define SOLIDSYSLOGWINDOWSSLEEP_H

Expand All @@ -9,7 +10,7 @@ SOLIDSYSLOG_EXTERN_C_BEGIN

/** Wraps Sleep so a bounded retry loop (e.g. the TLS handshake) yields to the
* scheduler between attempts. */
void SolidSyslogWindowsSleep(int milliseconds);
void SolidSyslogWindows_Sleep(int milliseconds);

SOLIDSYSLOG_EXTERN_C_END

Expand Down
2 changes: 1 addition & 1 deletion Platform/Windows/Interface/SolidSyslogWindowsSysUpTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SOLIDSYSLOG_EXTERN_C_BEGIN

/** Hundredths of a second since boot from GetTickCount64, as RFC 3418
* sysUpTime; wraps modulo 2^32 per the TimeTicks contract. */
uint32_t SolidSyslogWindowsSysUpTime_Get(void);
uint32_t SolidSyslogWindows_GetSysUpTime(void);

SOLIDSYSLOG_EXTERN_C_END

Expand Down
2 changes: 1 addition & 1 deletion Platform/Windows/Source/SolidSyslogWindowsClock.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static inline void WindowsClock_PopulateTimestamp(
uint32_t microseconds
);

void SolidSyslogWindowsClock_GetTimestamp(struct SolidSyslogTimestamp* timestamp)
void SolidSyslogWindows_GetTimestamp(struct SolidSyslogTimestamp* timestamp)
{
FILETIME fileTime;
SYSTEMTIME breakdown;
Expand Down
2 changes: 1 addition & 1 deletion Platform/Windows/Source/SolidSyslogWindowsHostname.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ enum
MAX_HOSTNAME_SIZE = 256U
};

void SolidSyslogWindowsHostname_Get(struct SolidSyslogHeaderField* field, void* context)
void SolidSyslogWindows_GetHostname(struct SolidSyslogHeaderField* field, void* context)
{
char hostname[MAX_HOSTNAME_SIZE];
DWORD size = sizeof(hostname);
Expand Down
2 changes: 1 addition & 1 deletion Platform/Windows/Source/SolidSyslogWindowsProcessId.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static DWORD WINAPI WindowsProcessId_CallGetCurrentProcessId(void)
return GetCurrentProcessId();
}

void SolidSyslogWindowsProcessId_Get(struct SolidSyslogHeaderField* field, void* context)
void SolidSyslogWindows_GetProcessId(struct SolidSyslogHeaderField* field, void* context)
{
(void) context;
SolidSyslogHeaderField_Uint32(field, (uint32_t) WindowsProcessId_GetCurrentProcessId());
Expand Down
2 changes: 1 addition & 1 deletion Platform/Windows/Source/SolidSyslogWindowsSleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <windows.h>

void SolidSyslogWindowsSleep(int milliseconds)
void SolidSyslogWindows_Sleep(int milliseconds)
{
Sleep((DWORD) milliseconds);
}
2 changes: 1 addition & 1 deletion Platform/Windows/Source/SolidSyslogWindowsSysUpTime.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ enum
MILLISECONDS_PER_HUNDREDTH = 10
};

uint32_t SolidSyslogWindowsSysUpTime_Get(void)
uint32_t SolidSyslogWindows_GetSysUpTime(void)
{
ULONGLONG milliseconds = WindowsSysUpTime_GetTickCount64();
return (uint32_t) (milliseconds / MILLISECONDS_PER_HUNDREDTH);
Expand Down
8 changes: 4 additions & 4 deletions Tests/FreeRtos/SolidSyslogFreeRtosSysUpTimeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,29 @@ TEST(SolidSyslogFreeRtosSysUpTime, ReturnsZeroWhenTicksAreZero)
{
FreeRtosTaskFake_SetTickCount(0);

UNSIGNED_LONGS_EQUAL(0U, SolidSyslogFreeRtosSysUpTime_Get());
UNSIGNED_LONGS_EQUAL(0U, SolidSyslogFreeRtos_GetSysUpTime());
}

TEST(SolidSyslogFreeRtosSysUpTime, ReturnsOneWhenTicksAreOne)

{
FreeRtosTaskFake_SetTickCount(1);

UNSIGNED_LONGS_EQUAL(1U, SolidSyslogFreeRtosSysUpTime_Get());
UNSIGNED_LONGS_EQUAL(1U, SolidSyslogFreeRtos_GetSysUpTime());
}

TEST(SolidSyslogFreeRtosSysUpTime, ReturnsTickCountAtMidRange)

{
FreeRtosTaskFake_SetTickCount(12345U);

UNSIGNED_LONGS_EQUAL(12345U, SolidSyslogFreeRtosSysUpTime_Get());
UNSIGNED_LONGS_EQUAL(12345U, SolidSyslogFreeRtos_GetSysUpTime());
}

TEST(SolidSyslogFreeRtosSysUpTime, ReturnsUint32MaxWhenTicksAreUint32Max)

{
FreeRtosTaskFake_SetTickCount(UINT32_MAX);

UNSIGNED_LONGS_EQUAL(UINT32_MAX, SolidSyslogFreeRtosSysUpTime_Get());
UNSIGNED_LONGS_EQUAL(UINT32_MAX, SolidSyslogFreeRtos_GetSysUpTime());
}
2 changes: 1 addition & 1 deletion Tests/SolidSyslogPosixClockTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ TEST_GROUP(SolidSyslogPosixClock)
static struct SolidSyslogTimestamp getTimestamp()
{
struct SolidSyslogTimestamp ts = {};
SolidSyslogPosixClock_GetTimestamp(&ts);
SolidSyslogPosix_GetTimestamp(&ts);
return ts;
}
};
Expand Down
6 changes: 3 additions & 3 deletions Tests/SolidSyslogPosixSleepTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
#include "CppUTest/TestHarness.h"

// clang-format off
TEST_GROUP(SolidSyslogPosixSleep)
TEST_GROUP(SolidSyslogPosix_Sleep)
{
};
// clang-format on

TEST(SolidSyslogPosixSleep, ReturnsImmediatelyForZero)
TEST(SolidSyslogPosix_Sleep, ReturnsImmediatelyForZero)
{
/* nanosleep with a zero-length duration is a defined no-op return; the
test simply pins that the wrapper does not crash and returns under
any vaguely reasonable wall-clock budget. Sub-millisecond completion
is the expected behaviour on every supported POSIX platform. */
SolidSyslogPosixSleep(0);
SolidSyslogPosix_Sleep(0);
}
Loading
Loading