diff options
author | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2011-11-25 09:18:59 +0100 |
---|---|---|
committer | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2011-11-25 09:18:59 +0100 |
commit | 6b3eac36d2fa1e0503217e6a21787ecfb1bc2dae (patch) | |
tree | b7c77217ae71794d9850841acb789e6e01b2598b /src | |
parent | 5d1256cc1fcf9d47a7bc0e8ac49a9365e7e59915 (diff) | |
download | DLT-daemon-6b3eac36d2fa1e0503217e6a21787ecfb1bc2dae.tar.gz |
Disabled completely SHM if not enabled.
Diffstat (limited to 'src')
-rwxr-xr-x | src/daemon/dlt-daemon.c | 8 | ||||
-rwxr-xr-x | src/daemon/dlt-daemon.h | 4 | ||||
-rwxr-xr-x | src/lib/dlt_user.c | 10 |
3 files changed, 22 insertions, 0 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c index dd18d4b..51b7b02 100755 --- a/src/daemon/dlt-daemon.c +++ b/src/daemon/dlt-daemon.c @@ -594,12 +594,14 @@ int dlt_daemon_local_init_p2(DltDaemon *daemon, DltDaemonLocal *daemon_local, in /* Set flag for optional sending of serial header */ daemon->sendserialheader = daemon_local->flags.lflag; +#ifdef DLT_SHM_ENABLE /* init shared memory */ if (dlt_shm_init_server(&(daemon_local->dlt_shm),DLT_SHM_KEY,daemon_local->flags.sharedMemorySize)==-1) { dlt_log(LOG_ERR,"Could not initialize shared memory\n"); return -1; } +#endif /* prepare main loop */ if (dlt_message_init(&(daemon_local->msg),daemon_local->flags.vflag)==-1) @@ -852,8 +854,10 @@ void dlt_daemon_local_cleanup(DltDaemon *daemon, DltDaemonLocal *daemon_local, i /* Try to delete existing pipe, ignore result of unlink() */ unlink(DLT_USER_FIFO); +#ifdef DLT_SHM_ENABLE /* free shared memory */ dlt_shm_free_server(&(daemon_local->dlt_shm)); +#endif /* Try to delete lock file, ignore result of unlink() */ unlink(DLT_DAEMON_LOCK_FILE); @@ -1249,6 +1253,7 @@ int dlt_daemon_process_user_messages(DltDaemon *daemon, DltDaemonLocal *daemon_l } break; } +#ifdef DLT_SHM_ENABLE case DLT_USER_MESSAGE_LOG_SHM: { if (dlt_daemon_process_user_message_log_shm(daemon, daemon_local, daemon_local->flags.vflag)==-1) @@ -1257,6 +1262,7 @@ int dlt_daemon_process_user_messages(DltDaemon *daemon, DltDaemonLocal *daemon_l } break; } +#endif case DLT_USER_MESSAGE_REGISTER_APPLICATION: { if (dlt_daemon_process_user_message_register_application(daemon, daemon_local, daemon_local->flags.vflag)==-1) @@ -1888,6 +1894,7 @@ int dlt_daemon_process_user_message_log(DltDaemon *daemon, DltDaemonLocal *daemo return 0; } +#ifdef DLT_SHM_ENABLE int dlt_daemon_process_user_message_log_shm(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose) { int bytes_to_be_removed=0; @@ -2073,6 +2080,7 @@ int dlt_daemon_process_user_message_log_shm(DltDaemon *daemon, DltDaemonLocal *d return 0; } +#endif int dlt_daemon_process_user_message_set_app_ll_ts(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose) { diff --git a/src/daemon/dlt-daemon.h b/src/daemon/dlt-daemon.h index 5d15326..16d7d61 100755 --- a/src/daemon/dlt-daemon.h +++ b/src/daemon/dlt-daemon.h @@ -135,7 +135,9 @@ typedef struct DltReceiver receiverSerial; /**< receiver for serial connection */
int client_connections; /**< counter for nr. of client connections */
size_t baudrate; /**< Baudrate of serial connection */
+#ifdef DLT_SHM_ENABLE
DltShm dlt_shm; /**< Shared memory handling */
+#endif
DltOfflineTrace offlineTrace; /**< Offline trace handling */
} DltDaemonLocal;
@@ -171,7 +173,9 @@ int dlt_daemon_process_user_message_unregister_application(DltDaemon *daemon, Dl int dlt_daemon_process_user_message_register_context(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
int dlt_daemon_process_user_message_unregister_context(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
int dlt_daemon_process_user_message_log(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
+#ifdef DLT_SHM_ENABLE
int dlt_daemon_process_user_message_log_shm(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
+#endif
int dlt_daemon_process_user_message_set_app_ll_ts(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
int dlt_daemon_process_user_message_log_mode(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c index 178df18..8c82dd3 100755 --- a/src/lib/dlt_user.c +++ b/src/lib/dlt_user.c @@ -160,7 +160,9 @@ int dlt_init(void) dlt_user.dlt_is_file = 0; dlt_user.overflow = 0; +#ifdef DLT_SHM_ENABLE memset(&(dlt_user.dlt_shm),0,sizeof(DltShm)); +#endif /* create and open DLT user FIFO */ sprintf(filename,"%s/dlt%d",DLT_USER_DIR,getpid()); @@ -195,6 +197,7 @@ int dlt_init(void) } else { +#ifdef DLT_SHM_ENABLE /* init shared memory */ if (dlt_shm_init_client(&(dlt_user.dlt_shm),DLT_SHM_KEY) < 0) { @@ -202,6 +205,7 @@ int dlt_init(void) dlt_log(LOG_WARNING, str); //return 0; } +#endif } @@ -362,8 +366,10 @@ int dlt_free(void) unlink(filename); } +#ifdef DLT_SHM_ENABLE /* free shared memory */ dlt_shm_free_client(&dlt_user.dlt_shm); +#endif if (dlt_user.dlt_log_handle!=-1) { @@ -2243,8 +2249,10 @@ int dlt_user_log_send_log(DltContextData *log, int mtype) close(dlt_user.dlt_log_handle); dlt_user.dlt_log_handle = -1; +#ifdef DLT_SHM_ENABLE /* free shared memory */ dlt_shm_free_client(&dlt_user.dlt_shm); +#endif if (dlt_user.local_print_mode == DLT_PM_AUTOMATIC) { @@ -2850,6 +2858,7 @@ void dlt_user_log_reattach_to_daemon(void) return; } +#ifdef DLT_SHM_ENABLE /* init shared memory */ if (dlt_shm_init_client(&dlt_user.dlt_shm,DLT_SHM_KEY) < 0) { @@ -2857,6 +2866,7 @@ void dlt_user_log_reattach_to_daemon(void) dlt_log(LOG_WARNING, str); //return 0; } +#endif dlt_log(LOG_NOTICE, "Logging re-enabled!\n"); |