[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gpsd-dev] Updated docs on NTP segment management
From: |
Eric S. Raymond |
Subject: |
[gpsd-dev] Updated docs on NTP segment management |
Date: |
Tue, 17 Feb 2015 12:49:34 -0500 (EST) |
Gary and other NTP experts:
I have attempted to update the big comment on NTP egment management in
ntpshm.c for the change that gpsd now allocates two segments for each
device it can drive, rather than a fixed set of 4. Of course this is
only relevant if more than two devices are attached.
I am not certain of the assertions I am making about NTP here, as
its documentation of this feature is scanty and I have to go by memories
of mailing-list traffic. Please chrck against your knowledge and correct.
/* Note: you can start gpsd as non-root, and have it work with ntpd.
* However, it will then only use the ntpshm segments 2 3, and higher.
*
*
* Ntpd always runs as root (to be able to control the system clock).
* Its rules for the creation of ntpshm segments are:
*
* Segments 0 and 1: permissions 0600, i.e. other programs can only
* read and write as root.
*
* Segments 2, 3, and higher:
* permissions 0666, i.e. other programs can read
* and write as any user. I.e.: if ntpd has been
* configured to use these segments, any
* unprivileged user is allowed to provide data
* for synchronisation.
*
* By default ntpd creates only 4 segments. It can be configured to
* create up to 217. gpsd creates two segments for each device it can
* drive; by default this is 8 segments for 4 devices,but can be higher
* if it was compiled with a larger value of MAX_DEVICES.
*
* Started as root, gpsd does as ntpd when attaching (creating) the
* segments. In contrast to ntpd, which only attaches (creates)
* configured segments, gpsd creates all segments. Thus a gpsd will
* bve default create two segments 4 and 5 that an ntpd with default
* configuration does not watch.
*
* Started as non-root, gpsd will only attach (create) segments 2-n with
* permissions 0666. As the permissions are for any user, the creator
* does not matter.
*
* For each GPS module gpsd controls, it will use the attached ntpshm
* segments in pairs (for coarse clock and pps source, respectively)
* starting from the first found segments. I.e. started as root, one
* GPS will deliver data on segments 0 and 1, and as non-root data
* will be delivered on segments 2 and higher.
*
* Segments are allocated to activated devices on a first-come-first-served
* basis. A device's segment is deallocated when the device is closed and
* may be re-used by devices connected later.
*
* To debug, try looking at the live segments this way
*
* ipcs -m
*
* results should look like this:
* ------ Shared Memory Segments --------
* key shmid owner perms bytes nattch status
* 0x4e545030 0 root 700 96 2
* 0x4e545031 32769 root 700 96 2
* 0x4e545032 163842 root 666 96 1
* 0x4e545033 196611 root 666 96 1
* 0x4e545034 253555 root 666 96 1
* 0x4e545035 367311 root 666 96 1
*
* For a bit more data try this:
* cat /proc/sysvipc/shm
*
* If gpsd can not open the segments be sure you are not running SELinux
* or apparmor.
*
* if you see the shared segments (keys 1314148400 -- 1314148405), and
* no gpsd or ntpd is running then try removing them like this:
*
* ipcrm -M 0x4e545030
* ipcrm -M 0x4e545031
* ipcrm -M 0x4e545032
* ipcrm -M 0x4e545033
* ipcrm -M 0x4e545034
* ipcrm -M 0x4e545035
*/
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
It is the assumption of this book that a work of art is a gift, not a
commodity. Or, to state the modern case with more precision, that works of
art exist simultaneously in two "economies," a market economy and a gift
economy. Only one of these is essential, however: a work of art can survive
without the market, but where there is no gift there is no art.
-- Lewis Hyde, The Gift: Imagination and the Erotic Life of Property
- [gpsd-dev] Updated docs on NTP segment management,
Eric S. Raymond <=
- Re: [gpsd-dev] Updated docs on NTP segment management, Gary E. Miller, 2015/02/17
- Re: [gpsd-dev] Updated docs on NTP segment management, Gary E. Miller, 2015/02/17
- Re: [gpsd-dev] Updated docs on NTP segment management, Eric S. Raymond, 2015/02/17
- Re: [gpsd-dev] Updated docs on NTP segment management, Gary E. Miller, 2015/02/17
- Re: [gpsd-dev] Updated docs on NTP segment management, Hal Murray, 2015/02/17
- Re: [gpsd-dev] Updated docs on NTP segment management, Gary E. Miller, 2015/02/17
- Re: [gpsd-dev] Updated docs on NTP segment management, Hal Murray, 2015/02/17
- Re: [gpsd-dev] Updated docs on NTP segment management, Harlan Stenn, 2015/02/18
- Re: [gpsd-dev] Updated docs on NTP segment management, Hal Murray, 2015/02/18
- Re: [gpsd-dev] Updated docs on NTP segment management, Eric S. Raymond, 2015/02/18