Add perm option to SHM driver
This commit is contained in:
parent
a0e1154bfb
commit
f261251a9b
2 changed files with 11 additions and 4 deletions
|
@ -2242,14 +2242,18 @@ refclock PPS /dev/pps0
|
||||||
|
|
||||||
@item SHM
|
@item SHM
|
||||||
NTP shared memory driver. The parameter is the number of the
|
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:
|
0, 1, 2 or 3. For example:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
refclock SHM 1 poll 3 refid GPS1
|
refclock SHM 1 poll 3 refid GPS1
|
||||||
@end example
|
@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}.
|
@code{gpsd} and @code{shmpps}.
|
||||||
@item SOCK
|
@item SOCK
|
||||||
Unix domain socket driver. The parameter is a path to the socket
|
Unix domain socket driver. The parameter is a path to the socket
|
||||||
|
|
|
@ -56,12 +56,15 @@ struct shmTime {
|
||||||
};
|
};
|
||||||
|
|
||||||
static int shm_initialise(RCL_Instance instance) {
|
static int shm_initialise(RCL_Instance instance) {
|
||||||
int id, param;
|
int id, param, perm;
|
||||||
|
char *s;
|
||||||
struct shmTime *shm;
|
struct shmTime *shm;
|
||||||
|
|
||||||
param = atoi(RCL_GetDriverParameter(instance));
|
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) {
|
if (id == -1) {
|
||||||
LOG_FATAL(LOGF_Refclock, "shmget() failed");
|
LOG_FATAL(LOGF_Refclock, "shmget() failed");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue