From 8ad0a06cef2ade0710d426b54941ab48f8412370 Mon Sep 17 00:00:00 2001 From: hadaq Date: Tue, 6 Jul 2010 15:35:08 +0000 Subject: [PATCH] chmod added for daq_ shared memory to open permissions for read by epics ioc. Sergey. --- hadaq/worker.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/hadaq/worker.c b/hadaq/worker.c index 735a4e0..f705564 100644 --- a/hadaq/worker.c +++ b/hadaq/worker.c @@ -1,4 +1,4 @@ -static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/worker.c,v 6.30 2008-05-28 14:56:16 hadaq Exp $"; +static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/worker.c,v 6.31 2010-07-06 15:35:08 hadaq Exp $"; #define WORKER_NEW_PROTOCOL @@ -55,11 +55,13 @@ static int createStatShm(Worker *my) { int retVal; char ipcNameS[_POSIX_PATH_MAX]; + char ipcFullNameS[_POSIX_PATH_MAX] = "/dev/shm/"; char *ipcName; strcpy(ipcNameS, my->name); ipcName = basename(ipcNameS); strcat(ipcName, ".shm"); + strcat(ipcFullNameS, ipcName); if (-1 == PsxShm_unlink(ipcName) && errno != ENOENT) { syslog(LOG_DEBUG, "%s:%d: %s", __FILE__, __LINE__, strerror(errno)); @@ -72,6 +74,11 @@ static int createStatShm(Worker *my) } else { my->statistics = my->shm->addr; strcpy(my->statistics[0].name, ""); + + if (-1 == chmod(ipcFullNameS, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)) { + syslog(LOG_ERR, "%s:%d: %s", __FILE__, __LINE__, strerror(errno)); + } + retVal = 0; } } @@ -123,9 +130,9 @@ static int closeStatShm(Worker *my) static int removeSigHandlers(Worker *my) { - return sigaction(my->signal0, my->oldSigAction0, NULL) - | sigaction(my->signal1, my->oldSigAction1, NULL) - | sigaction(my->signal2, my->oldSigAction2, NULL); + return sigaction(my->signal0, my->oldSigAction0, NULL) + | sigaction(my->signal1, my->oldSigAction1, NULL) + | sigaction(my->signal2, my->oldSigAction2, NULL); } static int installSigHandlers(Worker *my, int s0, int s1, int s2, void (*sigHandler) (int)) @@ -241,7 +248,7 @@ int Worker_start(const char *path, char *const argv[]) strcpy(my->name, argv[0]); #ifndef WORKER_NEW_PROTOCOL - installSigHandlers(my, SIGCHLD, SIGUSR1, SIGHUP , noopHandler); + installSigHandlers(my, SIGCHLD, SIGUSR1, SIGHUP, noopHandler); #endif my->pid = fork(); -- 2.43.0