]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Add perm option to SHM driver
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 28 Jan 2010 09:03:54 +0000 (10:03 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 28 Jan 2010 09:10:16 +0000 (10:10 +0100)
chrony.texi
refclock_shm.c

index b0235cda1cef8519e8dc43e5256f0ab1f23c5d4f..3f7c9b6c9309bc41c8a5ee169a7b76f45a6ef0e2 100644 (file)
@@ -2242,14 +2242,18 @@ refclock PPS /dev/pps0
 
 @item SHM
 NTP shared memory driver.  The parameter is the number of the
-shared memory segment that should be used to read timestamps, usually
+shared memory segment that should be used for receiving timestamps, usually
 0, 1, 2 or 3.  For example:
 
 @example
 refclock SHM 1 poll 3 refid GPS1
 @end example
 
-Software that can be used as a source of timestamps includes
+A driver option in form @code{:perm=NNN} can be appended to the
+segment number to create the segment with permissions other than the
+default @code{0600}. 
+
+Software that can be used as a source of reference time includes
 @code{gpsd} and @code{shmpps}.
 @item SOCK
 Unix domain socket driver.  The parameter is a path to the socket
index b3b689b5cb0e4341444e3ba37acf0f90eb549132..ed0c3d089674447bdeb629ae350e1608e528dae7 100644 (file)
@@ -56,12 +56,15 @@ struct shmTime {
 };
 
 static int shm_initialise(RCL_Instance instance) {
-  int id, param;
+  int id, param, perm;
+  char *s;
   struct shmTime *shm;
 
   param = atoi(RCL_GetDriverParameter(instance));
+  s = RCL_GetDriverOption(instance, "perm");
+  perm = s ? strtol(s, NULL, 8) : 0600;
 
-  id = shmget(SHMKEY + param, sizeof (struct shmTime), IPC_CREAT | 0700);
+  id = shmget(SHMKEY + param, sizeof (struct shmTime), IPC_CREAT | perm);
   if (id == -1) {
     LOG_FATAL(LOGF_Refclock, "shmget() failed");
     return 0;