summaryrefslogtreecommitdiff
path: root/usr.sbin/ntpd
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-09-18 07:33:15 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-09-18 07:33:15 +0000
commit7ebccf053fce13d43924c8f464eea9e6ff4335e8 (patch)
tree3f8adc6664eb102ca729117653b9b963ab22c5bf /usr.sbin/ntpd
parentb18954637b12e406ba9ffee0a8f87140156fe3fb (diff)
do not bother overallocating and shrinking the pfd and idx2peer arrays,
doesn't by us anything. discussed with ryan during dinner at original joe's
Diffstat (limited to 'usr.sbin/ntpd')
-rw-r--r--usr.sbin/ntpd/ntp.c22
-rw-r--r--usr.sbin/ntpd/ntpd.h4
2 files changed, 10 insertions, 16 deletions
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c
index 47828af9155..568178b2b87 100644
--- a/usr.sbin/ntpd/ntp.c
+++ b/usr.sbin/ntpd/ntp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntp.c,v 1.31 2004/09/15 19:21:25 henning Exp $ */
+/* $OpenBSD: ntp.c,v 1.32 2004/09/18 07:33:14 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -125,33 +125,29 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf)
peer_cnt++;
while (ntp_quit == 0) {
- if (peer_cnt > idx2peer_elms ||
- peer_cnt + IDX2PEER_RESERVE < idx2peer_elms) {
+ if (peer_cnt > idx2peer_elms) {
if ((newp = realloc(idx2peer, sizeof(void *) *
- (peer_cnt + IDX2PEER_RESERVE))) == NULL) {
+ peer_cnt)) == NULL) {
/* panic for now */
log_warn("could not resize idx2peer from %u -> "
- "%u entries", idx2peer_elms,
- peer_cnt + IDX2PEER_RESERVE);
+ "%u entries", idx2peer_elms, peer_cnt);
fatalx("exiting");
}
idx2peer = newp;
- idx2peer_elms = peer_cnt + IDX2PEER_RESERVE;
+ idx2peer_elms = peer_cnt;
}
new_cnt = PFD_MAX + peer_cnt + listener_cnt;
- if (new_cnt > pfd_elms ||
- new_cnt + PFD_RESERVE < pfd_elms) {
+ if (new_cnt > pfd_elms) {
if ((newp = realloc(pfd, sizeof(struct pollfd) *
- (new_cnt + PFD_RESERVE))) == NULL) {
+ new_cnt)) == NULL) {
/* panic for now */
log_warn("could not resize pfd from %u -> "
- "%u entries", pfd_elms,
- new_cnt + PFD_RESERVE);
+ "%u entries", pfd_elms, new_cnt);
fatalx("exiting");
}
pfd = newp;
- pfd_elms = new_cnt + PFD_RESERVE;
+ pfd_elms = new_cnt;
}
bzero(pfd, sizeof(struct pollfd) * pfd_elms);
diff --git a/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h
index 1c29af2f2ee..d571ba9f04e 100644
--- a/usr.sbin/ntpd/ntpd.h
+++ b/usr.sbin/ntpd/ntpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.h,v 1.36 2004/09/16 01:13:42 henning Exp $ */
+/* $OpenBSD: ntpd.h,v 1.37 2004/09/18 07:33:14 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -31,8 +31,6 @@
#define CONFFILE "/etc/ntpd.conf"
#define READ_BUF_SIZE 65535
-#define IDX2PEER_RESERVE 5
-#define PFD_RESERVE 10
#define NTPD_OPT_VERBOSE 0x0001
#define NTPD_OPT_VERBOSE2 0x0002