summaryrefslogtreecommitdiff
path: root/src/system
diff options
context:
space:
mode:
authorAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2014-03-25 13:24:52 +0100
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2014-04-01 09:46:43 +0200
commit20136d1af7dbf1d619499cc27e1c75e05368f3b6 (patch)
tree3cbd64d2cc9c8a14e772687a43f2c25619a224a6 /src/system
parent29e4f99d6db73e01e050726f1451b2d5f0281b7e (diff)
downloadDLT-daemon-20136d1af7dbf1d619499cc27e1c75e05368f3b6.tar.gz
Cygwin port: cygwin patch, signal handling patch and cppcheck and install lib dll to correct location on Windows. Originally from Mikko Rapeli <mikko.rapeli@bmw.de>.
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'src/system')
-rw-r--r--src/system/dlt-system-filetransfer.c16
-rw-r--r--src/system/dlt-system-watchdog.c4
2 files changed, 15 insertions, 5 deletions
diff --git a/src/system/dlt-system-filetransfer.c b/src/system/dlt-system-filetransfer.c
index b75f614..273eb88 100644
--- a/src/system/dlt-system-filetransfer.c
+++ b/src/system/dlt-system-filetransfer.c
@@ -44,7 +44,9 @@
#include <pthread.h>
#include <unistd.h>
+#ifdef linux
#include <sys/inotify.h>
+#endif
#include <libgen.h>
#include <dirent.h>
#include <zlib.h>
@@ -56,8 +58,10 @@
#include "dlt.h"
#include "dlt_filetransfer.h"
+#ifdef linux
#define INOTIFY_SZ (sizeof(struct inotify_event))
#define INOTIFY_LEN (INOTIFY_SZ + NAME_MAX + 1)
+#endif
#define Z_CHUNK_SZ 1024*128
#define COMPRESS_EXTENSION ".gz"
#define SUBDIR_COMPRESS ".tocompress"
@@ -72,12 +76,14 @@ extern unsigned long getFileSerialNumber(const char* file, int *ok);
DLT_IMPORT_CONTEXT(dltsystem);
DLT_DECLARE_CONTEXT(filetransferContext)
+#ifdef linux
typedef struct {
int handle;
int fd[DLT_SYSTEM_LOG_DIRS_MAX];
} s_ft_inotify;
s_ft_inotify ino;
+#endif
char *origin_name(char *src){
@@ -574,8 +580,9 @@ int init_filetransfer_dirs(FiletransferOptions const *opts)
{
DLT_LOG(dltsystem, DLT_LOG_DEBUG,
DLT_STRING("dlt-system-filetransfer, initializing inotify on directories."));
- ino.handle = inotify_init();
int i;
+#ifdef linux
+ ino.handle = inotify_init();
if(ino.handle < 0)
{
@@ -583,6 +590,7 @@ int init_filetransfer_dirs(FiletransferOptions const *opts)
DLT_STRING("Failed to initialize inotify in dlt-system file transfer."));
return -1;
}
+#endif
for(i = 0;i < opts->Count;i++)
{
@@ -616,7 +624,7 @@ int init_filetransfer_dirs(FiletransferOptions const *opts)
}
free(subdirpath);
-
+#ifdef linux
ino.fd[i] = inotify_add_watch(ino.handle, opts->Directory[i],
IN_CLOSE_WRITE|IN_MOVED_TO);
if(ino.fd[i] < 0)
@@ -628,7 +636,7 @@ int init_filetransfer_dirs(FiletransferOptions const *opts)
DLT_STRING(buf));
return -1;
}
-
+#endif
flush_dir(opts, i);
@@ -638,6 +646,7 @@ int init_filetransfer_dirs(FiletransferOptions const *opts)
int wait_for_files(FiletransferOptions const *opts)
{
+#ifdef linux
DLT_LOG(dltsystem, DLT_LOG_DEBUG, DLT_STRING("dlt-system-filetransfer, waiting for files."));
static char buf[INOTIFY_LEN];
ssize_t len = read(ino.handle, buf, INOTIFY_LEN);
@@ -679,6 +688,7 @@ int wait_for_files(FiletransferOptions const *opts)
}
i += INOTIFY_SZ + ie->len;
}
+#endif
return 0;
}
diff --git a/src/system/dlt-system-watchdog.c b/src/system/dlt-system-watchdog.c
index a45ef30..86b3346 100644
--- a/src/system/dlt-system-watchdog.c
+++ b/src/system/dlt-system-watchdog.c
@@ -152,7 +152,7 @@ void watchdog_thread(void *v_conf)
// Calculate half of WATCHDOG_USEC in ns for timer tick
notifiyPeriodNSec = watchdogTimeoutSeconds / 2 ;
- sprintf(str,"systemd watchdog timeout: %i nsec - timer will be initialized: %i nsec\n", watchdogTimeoutSeconds, notifiyPeriodNSec );
+ sprintf(str,"systemd watchdog timeout: %u nsec - timer will be initialized: %u nsec\n", watchdogTimeoutSeconds, notifiyPeriodNSec );
DLT_LOG(watchdogContext, DLT_LOG_DEBUG,DLT_STRING(str));
if (make_periodic (notifiyPeriodNSec, &info) < 0 )
@@ -176,7 +176,7 @@ void watchdog_thread(void *v_conf)
}
else
{
- sprintf(str,"systemd watchdog timeout incorrect: %i\n", watchdogTimeoutSeconds);
+ sprintf(str,"systemd watchdog timeout incorrect: %u\n", watchdogTimeoutSeconds);
DLT_LOG(watchdogContext, DLT_LOG_DEBUG,DLT_STRING(str));
}
}