diff options
author | Vo Trung Chi <chi.votrung@vn.bosch.com> | 2019-08-01 07:38:42 +0700 |
---|---|---|
committer | Saya Sugiura <39760799+ssugiura@users.noreply.github.com> | 2019-08-01 09:38:42 +0900 |
commit | 3f7dc3fd80e7fe548f89b96ab4228135dca688db (patch) | |
tree | efa1473fbd73b559fc6340c35479d060d2349553 /src/lib | |
parent | 8673795b845e461e42920e44cdf70a5361457e8b (diff) | |
download | DLT-daemon-3f7dc3fd80e7fe548f89b96ab4228135dca688db.tar.gz |
using POSIX shared memory APIs (#90) (#151)
Replace all Linux specific shared memory APIs with POSIX alternatives.
Signed-off-by: Vo Trung Chi <Chi.VoTrung@vn.bosch.com>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/dlt_user.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c index d040d38..4ae1fde 100644 --- a/src/lib/dlt_user.c +++ b/src/lib/dlt_user.c @@ -365,16 +365,12 @@ DltReturnValue dlt_init(void) memset(&(dlt_user.dlt_shm), 0, sizeof(DltShm)); /* init shared memory */ - if (dlt_shm_init_client(&(dlt_user.dlt_shm), DLT_SHM_KEY) < 0) { - dlt_vlog(LOG_WARNING, - "Logging disabled, Shared memory %d cannot be created!\n", - DLT_SHM_KEY); - /*return 0; */ - } + if (dlt_shm_init_client(&(dlt_user.dlt_shm), dltShmName) < DLT_RETURN_OK) + dlt_vnlog(LOG_WARNING, DLT_USER_BUFFER_LENGTH, "Logging disabled," + " Shared memory %s cannot be created!\n", dltShmName); #endif #ifdef DLT_USE_UNIX_SOCKET_IPC - if (dlt_initialize_socket_connection() != DLT_RETURN_OK) /* We could connect to the pipe, but not to the socket, which is normally */ /* open before by the DLT daemon => bad failure => return error code */ @@ -382,7 +378,6 @@ DltReturnValue dlt_init(void) return DLT_RETURN_ERROR; #else /* FIFO connection */ - if (dlt_initialize_fifo_connection() != DLT_RETURN_OK) return DLT_RETURN_ERROR; @@ -391,7 +386,6 @@ DltReturnValue dlt_init(void) dlt_user_initialised = false; return DLT_RETURN_ERROR; } - #endif /* These will be lazy initialized only when needed */ @@ -4439,13 +4433,9 @@ void dlt_user_log_reattach_to_daemon(void) #ifdef DLT_SHM_ENABLE /* init shared memory */ - if (dlt_shm_init_client(&dlt_user.dlt_shm, DLT_SHM_KEY) < 0) - dlt_vnlog(LOG_WARNING, - DLT_USER_BUFFER_LENGTH, - "Loging disabled, Shared memory %d cannot be created!\n", - DLT_SHM_KEY); - /*return DLT_RETURN_OK; */ - + if (dlt_shm_init_client(&dlt_user.dlt_shm, dltShmName) < DLT_RETURN_OK) + dlt_vnlog(LOG_WARNING, DLT_USER_BUFFER_LENGTH, "Logging disabled," + " Shared memory %s cannot be created!\n", dltShmName); #endif dlt_log(LOG_NOTICE, "Logging (re-)enabled!\n"); |