mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 17:55:07 -05:00
Compare commits
22 Commits
1.20
...
mandriva-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a4fa3330a | ||
|
|
fd35174928 | ||
|
|
2a30c56f03 | ||
|
|
0b8979a41e | ||
|
|
4771cbe8b0 | ||
|
|
1e7e7d3231 | ||
|
|
3e7781fdaf | ||
|
|
acd99f25ef | ||
|
|
91a91d1642 | ||
|
|
29223ea476 | ||
|
|
bcae93d321 | ||
|
|
383a36371f | ||
|
|
fa83311903 | ||
|
|
f5c3a01aee | ||
|
|
d2a7dc2347 | ||
|
|
3a8f93792b | ||
|
|
692d2799e4 | ||
|
|
c928cd857b | ||
|
|
77da5b6144 | ||
|
|
13ace061fa | ||
|
|
29953d6ddb | ||
|
|
6ff561dd23 |
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
*.swp
|
||||
*.o
|
||||
Makefile
|
||||
chronyc
|
||||
chronyd
|
||||
version.h
|
||||
@@ -86,7 +86,7 @@ clean :
|
||||
-rm -f *.o *.s chronyc chronyd core *~
|
||||
|
||||
version.h : version.txt
|
||||
sed -e 's/[$$]Name: \(.*\) [$$]/\1/;' < version.txt > version.h
|
||||
./mkversion
|
||||
|
||||
|
||||
# For install, don't use the install command, because its switches
|
||||
|
||||
8
NEWS
8
NEWS
@@ -1,3 +1,11 @@
|
||||
New in version 1.21
|
||||
===================
|
||||
|
||||
* Don't include Linux kernel header files any longer : allows chrony to compile
|
||||
on recent distros.
|
||||
* Stop trying to use RTC if continuous streams of error messages would occur
|
||||
(Linux with HPET).
|
||||
|
||||
New in version 1.20
|
||||
===================
|
||||
|
||||
|
||||
@@ -358,7 +358,7 @@ read_from_socket(void *anything)
|
||||
int status;
|
||||
ReceiveBuffer msg;
|
||||
struct sockaddr_in his_addr;
|
||||
int his_addr_len;
|
||||
socklen_t his_addr_len;
|
||||
int flags;
|
||||
int message_length;
|
||||
unsigned long remote_ip;
|
||||
|
||||
22
addrfilt.c
22
addrfilt.c
@@ -6,7 +6,7 @@
|
||||
chronyd/chronyc - Programs for keeping computer clocks accurate.
|
||||
|
||||
**********************************************************************
|
||||
* Copyright (C) Richard P. Curnow 1997-2002
|
||||
* Copyright (C) Richard P. Curnow 1997,1998,1999,2000,2001,2002,2005
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License as
|
||||
@@ -43,15 +43,11 @@
|
||||
/* Define the table size */
|
||||
#define TABLE_SIZE (1UL<<NBITS)
|
||||
|
||||
struct _TableNode;
|
||||
|
||||
typedef struct _TableNode ExtendedTable[TABLE_SIZE];
|
||||
|
||||
typedef enum {DENY, ALLOW, AS_PARENT} State;
|
||||
|
||||
typedef struct _TableNode {
|
||||
State state;
|
||||
ExtendedTable *extended;
|
||||
struct _TableNode *extended;
|
||||
} TableNode;
|
||||
|
||||
struct ADF_AuthTableInst {
|
||||
@@ -101,7 +97,7 @@ close_node(TableNode *node)
|
||||
|
||||
if (node->extended != NULL) {
|
||||
for (i=0; i<TABLE_SIZE; i++) {
|
||||
child_node = &((*(node->extended))[i]);
|
||||
child_node = &(node->extended[i]);
|
||||
close_node(child_node);
|
||||
}
|
||||
Free(node->extended);
|
||||
@@ -124,10 +120,10 @@ open_node(TableNode *node)
|
||||
|
||||
if (node->extended == NULL) {
|
||||
|
||||
node->extended = MallocNew(ExtendedTable);
|
||||
node->extended = MallocArray(struct _TableNode, TABLE_SIZE);
|
||||
|
||||
for (i=0; i<TABLE_SIZE; i++) {
|
||||
child_node = &((*(node->extended))[i]);
|
||||
child_node = &(node->extended[i]);
|
||||
child_node->state = AS_PARENT;
|
||||
child_node->extended = NULL;
|
||||
}
|
||||
@@ -168,7 +164,7 @@ set_subnet(TableNode *start_node,
|
||||
if (!(node->extended)) {
|
||||
open_node(node);
|
||||
}
|
||||
node = &((*(node->extended))[subnet]);
|
||||
node = &(node->extended[subnet]);
|
||||
bits_to_go -= NBITS;
|
||||
}
|
||||
|
||||
@@ -187,7 +183,7 @@ set_subnet(TableNode *start_node,
|
||||
if (!(node->extended)) {
|
||||
open_node(node);
|
||||
}
|
||||
node = &((*(node->extended))[subnet]);
|
||||
node = &(node->extended[subnet]);
|
||||
bits_to_go -= NBITS;
|
||||
}
|
||||
|
||||
@@ -199,7 +195,7 @@ set_subnet(TableNode *start_node,
|
||||
}
|
||||
|
||||
for (i=subnet, j=0; j<N; i++, j++) {
|
||||
this_node = &((*(node->extended))[i]);
|
||||
this_node = &(node->extended[i]);
|
||||
if (delete_children) {
|
||||
close_node(this_node);
|
||||
}
|
||||
@@ -283,7 +279,7 @@ check_ip_in_node(TableNode *start_node, unsigned long ip)
|
||||
if (node->extended) {
|
||||
subnet = get_subnet(residual);
|
||||
residual = get_residual(residual);
|
||||
node = &((*(node->extended))[subnet]);
|
||||
node = &(node->extended[subnet]);
|
||||
} else {
|
||||
/* Make decision on this node */
|
||||
finished = 1;
|
||||
|
||||
24
build_kit
24
build_kit
@@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
# $Header: /cvs/src/chrony/build_kit,v 1.13 2003/01/12 23:50:54 richard Exp $
|
||||
# Perl script for building a release
|
||||
|
||||
chmod 0755, "configure";
|
||||
|
||||
# Construct chrony.spec file
|
||||
$version = $ARGV[0] || die "No version on command line";
|
||||
open (IN, "<chrony.spec.sample");
|
||||
open (OUT, ">chrony.spec");
|
||||
while (<IN>) {
|
||||
s/\@\@VERSION\@\@/$version/;
|
||||
print OUT;
|
||||
}
|
||||
close (IN);
|
||||
close (OUT);
|
||||
|
||||
unlink "chrony.spec.sample";
|
||||
|
||||
# Requires the makeinfo from texinfo v4
|
||||
system("makeinfo --no-headers --number-sections -o chrony.txt chrony.texi");
|
||||
unlink("build_kit");
|
||||
unlink("LICINS");
|
||||
|
||||
3
chrony.1
3
chrony.1
@@ -63,3 +63,6 @@ Richard Curnow <rc@rc0.org.uk>
|
||||
This man-page was written by Jan Schaumann <jschauma@netmeister.org> as part
|
||||
of "The Missing Man Pages Project". Please see
|
||||
\fIhttp://www.netmeister.org/misc/m2p2/index.html\fR for details.
|
||||
|
||||
The complete chrony documentation is supplied in texinfo format.
|
||||
|
||||
|
||||
@@ -47,3 +47,6 @@ Richard Curnow <rc@rc0.org.uk>
|
||||
This man-page was written by Jan Schaumann <jschauma@netmeister.org> as part of "The Missing
|
||||
Man Pages Project". Please see \fIhttp://www.netmeister.org/misc/m2p2/index.html\fR
|
||||
for details.
|
||||
|
||||
The complete chrony documentation is supplied in texinfo format.
|
||||
|
||||
|
||||
@@ -836,7 +836,11 @@ compiled into the kernel). An estimate is made of the RTC error at a
|
||||
particular RTC second, and the rate at which the RTC gains or loses time
|
||||
relative to true time.
|
||||
|
||||
The RTC is fully supported in 2.2 and 2.4 kernels.
|
||||
The RTC is fully supported in 2.2, 2.4 and 2.6 kernels.
|
||||
|
||||
On 2.6 kernels, if your motherboard has a HPET, you need to enable the
|
||||
@samp{HPET_EMULATE_RTC} option in your kernel configuration. Otherwise, chrony
|
||||
will not be able to interact with the RTC device and will give up using it.
|
||||
|
||||
For kernels in the 2.0 series prior to 2.0.32, the kernel was set up to
|
||||
trim the RTC every 11 minutes. This would be disasterous for
|
||||
|
||||
66
chrony_timex.h
Normal file
66
chrony_timex.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* Taken from /usr/include/linux/timex.h. Avoids the need to
|
||||
* include kernel header files. */
|
||||
|
||||
#ifndef CHRONY_TIMEX_H
|
||||
#define CHRONY_TIMEX_H
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
struct timex {
|
||||
unsigned int modes; /* mode selector */
|
||||
long offset; /* time offset (usec) */
|
||||
long freq; /* frequency offset (scaled ppm) */
|
||||
long maxerror; /* maximum error (usec) */
|
||||
long esterror; /* estimated error (usec) */
|
||||
int status; /* clock command/status */
|
||||
long constant; /* pll time constant */
|
||||
long precision; /* clock precision (usec) (read only) */
|
||||
long tolerance; /* clock frequency tolerance (ppm)
|
||||
* (read only)
|
||||
*/
|
||||
struct timeval time; /* (read only) */
|
||||
long tick; /* (modified) usecs between clock ticks */
|
||||
|
||||
long ppsfreq; /* pps frequency (scaled ppm) (ro) */
|
||||
long jitter; /* pps jitter (us) (ro) */
|
||||
int shift; /* interval duration (s) (shift) (ro) */
|
||||
long stabil; /* pps stability (scaled ppm) (ro) */
|
||||
long jitcnt; /* jitter limit exceeded (ro) */
|
||||
long calcnt; /* calibration intervals (ro) */
|
||||
long errcnt; /* calibration errors (ro) */
|
||||
long stbcnt; /* stability limit exceeded (ro) */
|
||||
|
||||
int :32; int :32; int :32; int :32;
|
||||
int :32; int :32; int :32; int :32;
|
||||
int :32; int :32; int :32; int :32;
|
||||
};
|
||||
|
||||
#define ADJ_FREQUENCY 0x0002 /* frequency offset */
|
||||
#define ADJ_STATUS 0x0010 /* clock status */
|
||||
#define ADJ_TICK 0x4000 /* tick value */
|
||||
#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
|
||||
|
||||
#define SHIFT_USEC 16 /* frequency offset scale (shift) */
|
||||
|
||||
#define STA_PLL 0x0001 /* enable PLL updates (rw) */
|
||||
#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */
|
||||
#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */
|
||||
#define STA_FLL 0x0008 /* select frequency-lock mode (rw) */
|
||||
|
||||
#define STA_INS 0x0010 /* insert leap (rw) */
|
||||
#define STA_DEL 0x0020 /* delete leap (rw) */
|
||||
#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */
|
||||
#define STA_FREQHOLD 0x0080 /* hold frequency (rw) */
|
||||
|
||||
#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */
|
||||
#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */
|
||||
#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */
|
||||
#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */
|
||||
|
||||
#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */
|
||||
|
||||
/* This doesn't seem to be in any include files !! */
|
||||
|
||||
extern int adjtimex(struct timex *);
|
||||
|
||||
#endif /* CHRONY_TIMEX_H */
|
||||
@@ -40,10 +40,10 @@ interactively.
|
||||
1.17
|
||||
|
||||
.SH BUGS
|
||||
To report bugs, please contact the author and/or visit \fIhttp://go.to/chrony\fR
|
||||
To report bugs, please contact the author and/or visit \fIhttp://chrony.sunsite.dk/\fR
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR chronyd(1),
|
||||
.BR chronyd(8),
|
||||
.BR chrony(1)
|
||||
|
||||
.I http://chrony.sunsite.dk/
|
||||
@@ -54,3 +54,6 @@ Richard Curnow <rc@rc0.org.uk>
|
||||
This man-page was written by Jan Schaumann <jschauma@netmeister.org> as part of "The Missing
|
||||
Man Pages Project". Please see \fIhttp://www.netmeister.org/misc/m2p2/index.html\fR
|
||||
for details.
|
||||
|
||||
The complete chrony documentation is supplied in texinfo format.
|
||||
|
||||
|
||||
@@ -109,3 +109,6 @@ Richard Curnow <rc@rc0.org.uk>
|
||||
This man-page was written by Jan Schaumann <jschauma@netmeister.org> as part
|
||||
of "The Missing Man Pages Project". Please see
|
||||
\fIhttp://www.netmeister.org/misc/m2p2/index.html\fR for details.
|
||||
|
||||
The complete chrony documentation is supplied in texinfo format.
|
||||
|
||||
|
||||
17
client.c
17
client.c
@@ -146,7 +146,7 @@ read_line(void)
|
||||
static unsigned long
|
||||
get_address(const char *hostname)
|
||||
{
|
||||
unsigned char *address0;
|
||||
char *address0;
|
||||
struct hostent *host;
|
||||
unsigned long result;
|
||||
|
||||
@@ -746,7 +746,7 @@ static int
|
||||
accheck_getaddr(char *line, unsigned long *addr)
|
||||
{
|
||||
unsigned long a, b, c, d, ip;
|
||||
unsigned char *p, *q;
|
||||
char *p, *q;
|
||||
p = line;
|
||||
while (*p && isspace(*p)) p++;
|
||||
if (!*p) {
|
||||
@@ -1124,7 +1124,7 @@ static int
|
||||
submit_request(CMD_Request *request, CMD_Reply *reply, int *reply_auth_ok)
|
||||
{
|
||||
unsigned long tx_sequence;
|
||||
int where_from_len;
|
||||
socklen_t where_from_len;
|
||||
struct sockaddr_in where_from;
|
||||
int bad_length, bad_sender, bad_sequence, bad_header;
|
||||
int select_status;
|
||||
@@ -1652,7 +1652,7 @@ process_cmd_tracking(char *line)
|
||||
ref_time.tv_usec = ntohl(reply.data.tracking.ref_time_us);
|
||||
ref_time_tm = *gmtime((time_t *)&ref_time.tv_sec);
|
||||
printf("Ref time (UTC) : %s", asctime(&ref_time_tm));
|
||||
correction_tv.tv_sec = ntohl(reply.data.tracking.current_correction_s);
|
||||
correction_tv.tv_sec = (int32_t)ntohl(reply.data.tracking.current_correction_s);
|
||||
correction_tv.tv_usec = ntohl(reply.data.tracking.current_correction_us);
|
||||
correction = (double) correction_tv.tv_sec + 1.0e-6 * correction_tv.tv_usec;
|
||||
printf("System time : %.6f seconds %s of NTP time\n", fabs(correction),
|
||||
@@ -2319,7 +2319,11 @@ process_line(char *line)
|
||||
/* Check for line being blank */
|
||||
p = line;
|
||||
while (*p && isspace((unsigned char)*p)) p++;
|
||||
if (!*p) return quit;
|
||||
if (!*p) {
|
||||
fflush(stderr);
|
||||
fflush(stdout);
|
||||
return quit;
|
||||
};
|
||||
|
||||
if (!strncmp(p, "offline", 7)) {
|
||||
do_normal_submit = process_cmd_offline(&tx_message, p+7);
|
||||
@@ -2480,7 +2484,8 @@ process_line(char *line)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fflush(stderr);
|
||||
fflush(stdout);
|
||||
return quit;
|
||||
}
|
||||
|
||||
|
||||
2
cmdmon.c
2
cmdmon.c
@@ -1584,7 +1584,7 @@ read_from_cmd_socket(void *anything)
|
||||
CMD_Reply tx_message, *prev_tx_message;
|
||||
int rx_message_length, tx_message_length;
|
||||
struct sockaddr_in where_from;
|
||||
int from_length;
|
||||
socklen_t from_length;
|
||||
unsigned long remote_ip;
|
||||
unsigned short remote_port;
|
||||
int md5_ok;
|
||||
|
||||
16
configure
vendored
16
configure
vendored
@@ -241,20 +241,14 @@ case $SYSTEM in
|
||||
EXTRA_OBJECTS="sys_linux.o wrap_adjtimex.o rtc_linux.o"
|
||||
SYSDEFS="-DLINUX"
|
||||
echo "Configuring for " $SYSTEM
|
||||
if [ -r /usr/include/linux/spinlock.h ]; then
|
||||
SYSDEFS="$SYSDEFS -DHAS_SPINLOCK_H"
|
||||
echo "The system has <spinlock.h>, using that"
|
||||
else
|
||||
echo "The system does not have <spinlock.h>, using private definition for spinlock_t"
|
||||
if [ "${MACHINE}" = "alpha" ]; then
|
||||
echo "Enabling -mieee"
|
||||
# FIXME: Should really test for GCC
|
||||
SYSDEFS="$SYSDEFS -mieee -DALPHA"
|
||||
fi
|
||||
if [ "${MACHINE}" = "alpha" ]; then
|
||||
echo "Enabling -mieee"
|
||||
# FIXME: Should really test for GCC
|
||||
SYSDEFS="$SYSDEFS -mieee -DALPHA"
|
||||
fi
|
||||
;;
|
||||
|
||||
BSD/386-i[3456]86 )
|
||||
BSD/386-i[3456]86|FreeBSD-i386 )
|
||||
# Antti Jrvinen <costello@iki.fi> reported that this system can
|
||||
# be supported with the SunOS 4.x driver files.
|
||||
EXTRA_OBJECTS="sys_sunos.o strerror.o"
|
||||
|
||||
3
faq.txt
3
faq.txt
@@ -154,6 +154,9 @@ There have also been reports that just replacing the file
|
||||
/usr/src/linux/spinlock.h by the equivalent file from a vanilla kernel source
|
||||
tree is sufficient to fix the problem.
|
||||
|
||||
Note : from version 1.21 onwards, this problem no longer exists. The kernel
|
||||
header files are no longer included.
|
||||
|
||||
S: Selection of NTP servers
|
||||
Q: I have several computers on a LAN. Should I make one the master, or make them all clients of an external server?
|
||||
I think the best configuration is to make one computer the master, with the
|
||||
|
||||
74
io_linux.h
Normal file
74
io_linux.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/* Taken from <asm-$foo/ioctl.h> in the Linux kernel sources.
|
||||
* The ioctl.h file is pretty similar from one architecture to another.
|
||||
* */
|
||||
#ifndef IO_LINUX_H
|
||||
#define IO_LINUX_H
|
||||
|
||||
/* Hmm. These constants vary a bit between systems. */
|
||||
/* (__sh__ includes both sh and sh64) */
|
||||
#if defined(__i386__) || defined(__sh__)
|
||||
#define CHRONY_IOC_NRBITS 8
|
||||
#define CHRONY_IOC_TYPEBITS 8
|
||||
#define CHRONY_IOC_SIZEBITS 14
|
||||
#define CHRONY_IOC_DIRBITS 2
|
||||
|
||||
#define CHRONY_IOC_NONE 0U
|
||||
#define CHRONY_IOC_WRITE 1U
|
||||
#define CHRONY_IOC_READ 2U
|
||||
|
||||
#elif defined(__alpha__) || defined(__sparc__) || defined(__ppc__) || defined(__ppc64__) || defined(__sparc64__)
|
||||
#define CHRONY_IOC_NRBITS 8
|
||||
#define CHRONY_IOC_TYPEBITS 8
|
||||
#define CHRONY_IOC_SIZEBITS 13
|
||||
#define CHRONY_IOC_DIRBITS 2
|
||||
|
||||
#define CHRONY_IOC_NONE 1U
|
||||
#define CHRONY_IOC_READ 2U
|
||||
#define CHRONY_IOC_WRITE 4U
|
||||
|
||||
#elif defined(__mips__) || defined(__mips32__)
|
||||
#define CHRONY_IOC_NRBITS 8
|
||||
#define CHRONY_IOC_TYPEBITS 8
|
||||
#define CHRONY_IOC_SIZEBITS 13
|
||||
#define CHRONY_IOC_DIRBITS 3
|
||||
#define CHRONY_IOC_NONE 1U
|
||||
#define CHRONY_IOC_READ 2U
|
||||
#define CHRONY_IOC_WRITE 4U
|
||||
|
||||
#else
|
||||
#error "I don't know the values of the _IOC_* constants for your architecture"
|
||||
#endif
|
||||
|
||||
#define CHRONY_IOC_NRMASK ((1 << CHRONY_IOC_NRBITS)-1)
|
||||
#define CHRONY_IOC_TYPEMASK ((1 << CHRONY_IOC_TYPEBITS)-1)
|
||||
#define CHRONY_IOC_SIZEMASK ((1 << CHRONY_IOC_SIZEBITS)-1)
|
||||
#define CHRONY_IOC_DIRMASK ((1 << CHRONY_IOC_DIRBITS)-1)
|
||||
|
||||
#define CHRONY_IOC_NRSHIFT 0
|
||||
#define CHRONY_IOC_TYPESHIFT (CHRONY_IOC_NRSHIFT+CHRONY_IOC_NRBITS)
|
||||
#define CHRONY_IOC_SIZESHIFT (CHRONY_IOC_TYPESHIFT+CHRONY_IOC_TYPEBITS)
|
||||
#define CHRONY_IOC_DIRSHIFT (CHRONY_IOC_SIZESHIFT+CHRONY_IOC_SIZEBITS)
|
||||
|
||||
#define CHRONY_IOC(dir,type,nr,size) \
|
||||
(((dir) << CHRONY_IOC_DIRSHIFT) | \
|
||||
((type) << CHRONY_IOC_TYPESHIFT) | \
|
||||
((nr) << CHRONY_IOC_NRSHIFT) | \
|
||||
((size) << CHRONY_IOC_SIZESHIFT))
|
||||
|
||||
/* used to create numbers */
|
||||
#define CHRONY_IO(type,nr) CHRONY_IOC(CHRONY_IOC_NONE,(type),(nr),0)
|
||||
#define CHRONY_IOR(type,nr,size) CHRONY_IOC(CHRONY_IOC_READ,(type),(nr),sizeof(size))
|
||||
#define CHRONY_IOW(type,nr,size) CHRONY_IOC(CHRONY_IOC_WRITE,(type),(nr),sizeof(size))
|
||||
#define CHRONY_IOWR(type,nr,size) CHRONY_IOC(CHRONY_IOC_READ|CHRONY_IOC_WRITE,(type),(nr),sizeof(size))
|
||||
|
||||
#define RTC_UIE_ON CHRONY_IO('p', 0x03) /* Update int. enable on */
|
||||
#define RTC_UIE_OFF CHRONY_IO('p', 0x04) /* ... off */
|
||||
|
||||
#define RTC_RD_TIME CHRONY_IOR('p', 0x09, struct rtc_time) /* Read RTC time */
|
||||
#define RTC_SET_TIME CHRONY_IOW('p', 0x0a, struct rtc_time) /* Set RTC time */
|
||||
|
||||
/* From mc146818.h */
|
||||
#define RTC_UIE 0x10 /* update-finished interrupt enable */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -116,7 +116,7 @@ LOG_Line_Function(LOG_Severity severity, LOG_Facility facility, const char *form
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
volatile void
|
||||
void
|
||||
LOG_Fatal_Function(LOG_Facility facility, const char *format, ...)
|
||||
{
|
||||
char buf[2048];
|
||||
|
||||
@@ -77,7 +77,7 @@ extern void LOG_Finalise(void);
|
||||
extern void LOG_Line_Function(LOG_Severity severity, LOG_Facility facility, const char *format, ...);
|
||||
|
||||
/* Logging function for fatal errors */
|
||||
extern volatile void LOG_Fatal_Function(LOG_Facility facility, const char *format, ...);
|
||||
extern void LOG_Fatal_Function(LOG_Facility facility, const char *format, ...);
|
||||
|
||||
/* Position in code reporting function */
|
||||
extern void LOG_Position(const char *filename, int line_number, const char *function_name);
|
||||
|
||||
2
main.c
2
main.c
@@ -74,7 +74,7 @@ delete_pidfile(void)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
volatile void
|
||||
void
|
||||
MAI_CleanupAndExit(void)
|
||||
{
|
||||
if (!initialised) exit(0);
|
||||
|
||||
2
main.h
2
main.h
@@ -32,7 +32,7 @@
|
||||
#define GOT_MAIN_H
|
||||
|
||||
/* Function to clean up at end of run */
|
||||
extern volatile void MAI_CleanupAndExit(void);
|
||||
extern void MAI_CleanupAndExit(void);
|
||||
|
||||
#endif /* GOT_MAIN_H */
|
||||
|
||||
|
||||
52
make_release
Executable file
52
make_release
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
$tool = "chrony";
|
||||
|
||||
$version = shift || die "Usage : $0 <version>\n";
|
||||
$subdir = "${tool}-${version}";
|
||||
|
||||
unless (-d ".git") {
|
||||
die "No .git subdirectory?"
|
||||
}
|
||||
|
||||
unless (-d "RELEASES") {
|
||||
mkdir "RELEASES", 0755;
|
||||
}
|
||||
|
||||
system ("git-tag -s $version");
|
||||
die "git-tag failed" if ($? != 0);
|
||||
if (-d "RELEASES/$subdir") {
|
||||
system ("rm -rf RELEASES/$subdir");
|
||||
}
|
||||
|
||||
system ("git-tar-tree $version RELEASES/${subdir} | tar xf -");
|
||||
die "git-tar-tree failed" if ($? != 0);
|
||||
|
||||
chdir "RELEASES";
|
||||
$here = qx/pwd/;
|
||||
chomp $here;
|
||||
chdir $subdir;
|
||||
|
||||
open (OUT, ">version.txt");
|
||||
print OUT $version."\n";
|
||||
close OUT;
|
||||
|
||||
open (IN, "<${tool}.spec.sample");
|
||||
open (OUT, ">${tool}.spec");
|
||||
while (<IN>) {
|
||||
s/\@\@VERSION\@\@/$version/;
|
||||
print OUT;
|
||||
}
|
||||
close (IN);
|
||||
close (OUT);
|
||||
|
||||
system("makeinfo --no-headers --number-sections -o chrony.txt chrony.texi");
|
||||
unlink "make_release";
|
||||
unlink "${tool}.spec.sample";
|
||||
unlink ".gitignore";
|
||||
|
||||
chdir $here;
|
||||
system ("tar cvf - $subdir | gzip -9 > ${subdir}.tar.gz");
|
||||
system ("gpg -b -a -o ${subdir}-tar-gz-asc.txt ${subdir}.tar.gz");
|
||||
|
||||
|
||||
15
mkversion
Executable file
15
mkversion
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -f version.h
|
||||
echo "#ifndef VERSION_H" > version.h
|
||||
echo "#define VERSION_H 1" >> version.h
|
||||
|
||||
if [ -f version.txt ]; then
|
||||
ver=`cat version.txt`
|
||||
echo "#define PROGRAM_VERSION_STRING \"$ver\"" >> version.h
|
||||
else
|
||||
echo "#define PROGRAM_VERSION_STRING \"DEVELOPMENT\"" >> version.h
|
||||
fi
|
||||
|
||||
echo "#endif /* VERSION_H */" >> version.h
|
||||
|
||||
@@ -39,7 +39,7 @@ unsigned long
|
||||
DNS_Name2IPAddress(const char *name)
|
||||
{
|
||||
struct hostent *host;
|
||||
unsigned char *address0;
|
||||
char *address0;
|
||||
unsigned long result;
|
||||
|
||||
host = gethostbyname(name);
|
||||
|
||||
@@ -378,7 +378,7 @@ generate_packet_auth(NTP_Packet *pkt, unsigned long keyid)
|
||||
if (keyok) {
|
||||
pkt->auth_keyid = htonl(keyid);
|
||||
MD5Init(&ctx);
|
||||
MD5Update(&ctx, keytext, keylen);
|
||||
MD5Update(&ctx, (unsigned char *) keytext, keylen);
|
||||
MD5Update(&ctx, (unsigned char *) pkt, offsetof(NTP_Packet, auth_keyid));
|
||||
MD5Final(&ctx);
|
||||
memcpy(&(pkt->auth_data), &ctx.digest, 16);
|
||||
@@ -447,7 +447,7 @@ check_packet_auth(NTP_Packet *pkt, unsigned long keyid)
|
||||
if (keyok) {
|
||||
pkt->auth_keyid = htonl(keyid);
|
||||
MD5Init(&ctx);
|
||||
MD5Update(&ctx, keytext, keylen);
|
||||
MD5Update(&ctx, (unsigned char *) keytext, keylen);
|
||||
MD5Update(&ctx, (unsigned char *) pkt, offsetof(NTP_Packet, auth_keyid));
|
||||
MD5Final(&ctx);
|
||||
if (!memcmp((void *) &ctx.digest, (void *) &(pkt->auth_data), 16)) {
|
||||
|
||||
2
ntp_io.c
2
ntp_io.c
@@ -184,7 +184,7 @@ read_from_socket(void *anything)
|
||||
ReceiveBuffer message;
|
||||
int message_length;
|
||||
struct sockaddr_in where_from;
|
||||
int from_length;
|
||||
socklen_t from_length;
|
||||
unsigned int flags = 0;
|
||||
struct timeval now;
|
||||
NTP_Remote_Address remote_addr;
|
||||
|
||||
51
rtc_linux.c
51
rtc_linux.c
@@ -43,32 +43,6 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAS_SPINLOCK_H
|
||||
#include <linux/spinlock.h>
|
||||
#else
|
||||
/* Include dummy definition of spinlock_t to cope with earlier kernels. */
|
||||
typedef int spinlock_t;
|
||||
#endif
|
||||
|
||||
/* This is a complete hack since the alpha sys/io.h needs these types
|
||||
* but does not arrange them to be defined. This is almost certainly
|
||||
* not how one should do these things. -- broonie
|
||||
*/
|
||||
#include <linux/types.h>
|
||||
#ifdef __alpha__
|
||||
typedef __u8 u8;
|
||||
typedef __u16 u16;
|
||||
typedef __u32 u32;
|
||||
typedef __u64 u64;
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) /* || defined(__sparc__) */
|
||||
#include <linux/mc146818rtc.h>
|
||||
#else
|
||||
#include <linux/rtc.h>
|
||||
#define RTC_UIE 0x10 /* update-finished interrupt enable */
|
||||
#endif
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
@@ -84,10 +58,23 @@ typedef __u64 u64;
|
||||
#include "regress.h"
|
||||
#include "rtc.h"
|
||||
#include "rtc_linux.h"
|
||||
#include "io_linux.h"
|
||||
#include "conf.h"
|
||||
#include "memory.h"
|
||||
#include "mkdirpp.h"
|
||||
|
||||
struct rtc_time {
|
||||
int tm_sec;
|
||||
int tm_min;
|
||||
int tm_hour;
|
||||
int tm_mday;
|
||||
int tm_mon;
|
||||
int tm_year;
|
||||
int tm_wday;
|
||||
int tm_yday;
|
||||
int tm_isdst;
|
||||
};
|
||||
|
||||
/* ================================================== */
|
||||
/* Forward prototypes */
|
||||
|
||||
@@ -880,9 +867,19 @@ read_from_device(void *any)
|
||||
|
||||
status = read(fd, &data, sizeof(data));
|
||||
if (status < 0) {
|
||||
/* This looks like a bad error : the file descriptor was indicating it was
|
||||
* ready to read but we couldn't read anything. Give up. */
|
||||
LOG(LOGS_ERR, LOGF_RtcLinux, "Could not read flags %s : %s", CNF_GetRtcDevice(), strerror(errno));
|
||||
error = 1;
|
||||
goto turn_off_interrupt;
|
||||
SCH_RemoveInputFileHandler(fd);
|
||||
switch_interrupts(0); /* Likely to raise error too, but just to be sure... */
|
||||
close(fd);
|
||||
fd = -1;
|
||||
if (logfile) {
|
||||
fclose(logfile);
|
||||
logfile = NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ((data & RTC_UIE) == RTC_UIE) {
|
||||
|
||||
@@ -98,7 +98,7 @@ static void handle_end_of_slew(void *anything);
|
||||
/* ================================================== */
|
||||
|
||||
inline static int
|
||||
round(double x) {
|
||||
our_round(double x) {
|
||||
int y;
|
||||
y = (int)(x + 0.5);
|
||||
while ((double)y < x - 0.5) y++;
|
||||
@@ -433,7 +433,7 @@ set_frequency(double freq_ppm) {
|
||||
neg = 0;
|
||||
}
|
||||
|
||||
required_delta_tick = round(freq_ppm / dhz);
|
||||
required_delta_tick = our_round(freq_ppm / dhz);
|
||||
required_freq = freq_ppm - dhz * (double) required_delta_tick;
|
||||
|
||||
if (neg) {
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#if defined (SOLARIS) || defined(SUNOS) || defined(LINUX) || defined(__NetBSD__)
|
||||
|
||||
#if !defined(__NetBSD__)
|
||||
#if !defined(__NetBSD__) && !defined(__FreeBSD__)
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
@@ -43,7 +43,9 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <float.h>
|
||||
#if !defined(__FreeBSD__)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <math.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
2
util.c
2
util.c
@@ -232,7 +232,7 @@ UTI_TimevalToString(struct timeval *tv)
|
||||
stm = *gmtime((time_t *) &(tv->tv_sec));
|
||||
strftime(buffer, sizeof(buffer), "%a %x %X", &stm);
|
||||
result = NEXT_BUFFER;
|
||||
snprintf(result, sizeof(buffer), "%s.%06ld", buffer, (unsigned long)(tv->tv_usec));
|
||||
snprintf(result, BUFFER_LENGTH, "%s.%06ld", buffer, (unsigned long)(tv->tv_usec));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1 @@
|
||||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
#define PROGRAM_VERSION_STRING "$Name: $"
|
||||
#endif /* VERSION_H */
|
||||
DEVELOPMENT
|
||||
|
||||
@@ -36,16 +36,9 @@
|
||||
|
||||
#define _LOOSE_KERNEL_NAMES
|
||||
|
||||
#include <linux/time.h>
|
||||
#include <linux/timex.h>
|
||||
#include <asm/param.h>
|
||||
|
||||
#include "chrony_timex.h"
|
||||
#include "wrap_adjtimex.h"
|
||||
|
||||
/* This doesn't seem to be in any include files !! */
|
||||
|
||||
extern int adjtimex(struct timex *);
|
||||
|
||||
int
|
||||
TMX_SetTick(long tick)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user