gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-dev] Updated docs on NTP segment management


From: Gary E. Miller
Subject: Re: [gpsd-dev] Updated docs on NTP segment management
Date: Tue, 17 Feb 2015 11:23:22 -0800

Yo Eric!

Good start.  See below.

On Tue, 17 Feb 2015 12:49:34 -0500 (EST)
address@hidden (Eric S. Raymond) wrote:

>  * Ntpd always runs as root (to be able to control the system clock).

ntpd always starts as root (to be able to control the clock).  Then it
often drop s to run as user ntpd and group ntpd.


>  * Its rules for the creation of ntpshm segments are:

As of February 2015, the rules for the creation of ntpshm segmensts 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.  

By default, ntpd creates and uses no 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

by default create four segments (), 1, 2 and 3) that an ntpd with default

>  * configuration does not watch.
>  *
>  * Started as non-root, gpsd will only attach (create) segments 2-n

Started as non-root, gpsd will only attach (create) segments 2 and
above

> 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

GPS will deliver data on segments 0 and 1, and higher, 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

* basis. A device's segment is marked internally to gpsd as unused 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

* There is usually no reason to remove unused segments.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97701
        address@hidden  Tel:+1(541)382-8588



reply via email to

[Prev in Thread] Current Thread [Next in Thread]