003 File Manager
Current Path:
/usr/src/contrib/ntp/ntpd
usr
/
src
/
contrib
/
ntp
/
ntpd
/
📁
..
📄
Makefile.am
(13.57 KB)
📄
Makefile.in
(78.52 KB)
📄
check_y2k.c
(15.73 KB)
📄
cmd_args.c
(4.25 KB)
📄
complete.conf.in
(3.35 KB)
📄
declcond.h
(793 B)
📄
invoke-ntp.conf.menu
(56 B)
📄
invoke-ntp.conf.texi
(104.37 KB)
📄
invoke-ntp.keys.menu
(56 B)
📄
invoke-ntp.keys.texi
(3.21 KB)
📄
invoke-ntpd.menu
(49 B)
📄
invoke-ntpd.texi
(23.68 KB)
📄
jupiter.h
(9.1 KB)
📄
keyword-gen-utd
(57 B)
📄
keyword-gen.c
(21.99 KB)
📄
ntp.conf.5man
(115.01 KB)
📄
ntp.conf.5mdoc
(101.72 KB)
📄
ntp.conf.def
(100.75 KB)
📄
ntp.conf.html
(126.28 KB)
📄
ntp.conf.man.in
(115.01 KB)
📄
ntp.conf.mdoc.in
(101.71 KB)
📄
ntp.conf.texi
(1.19 KB)
📄
ntp.keys.5man
(3.99 KB)
📄
ntp.keys.5mdoc
(4.25 KB)
📄
ntp.keys.def
(3.65 KB)
📄
ntp.keys.html
(8.37 KB)
📄
ntp.keys.man.in
(3.99 KB)
📄
ntp.keys.mdoc.in
(4.24 KB)
📄
ntp.keys.texi
(1.2 KB)
📄
ntp_config.c
(117.55 KB)
📄
ntp_control.c
(123.14 KB)
📄
ntp_crypto.c
(117.09 KB)
📄
ntp_filegen.c
(13.42 KB)
📄
ntp_io.c
(112.21 KB)
📄
ntp_keyword.h
(73.49 KB)
📄
ntp_leapsec.c
(31.18 KB)
📄
ntp_leapsec.h
(10.95 KB)
📄
ntp_loopfilter.c
(40.05 KB)
📄
ntp_monitor.c
(13.43 KB)
📄
ntp_parser.c
(130.65 KB)
📄
ntp_parser.h
(11.36 KB)
📄
ntp_peer.c
(27.66 KB)
📄
ntp_prio_q.c
(4.54 KB)
📄
ntp_proto.c
(150.76 KB)
📄
ntp_refclock.c
(43.87 KB)
📄
ntp_request.c
(67.25 KB)
📄
ntp_restrict.c
(19.06 KB)
📄
ntp_scanner.c
(20.74 KB)
📄
ntp_scanner.h
(4.43 KB)
📄
ntp_signd.c
(5.24 KB)
📄
ntp_timer.c
(17.69 KB)
📄
ntp_util.c
(22.66 KB)
📄
ntpd-opts.c
(71.91 KB)
📄
ntpd-opts.def
(17.55 KB)
📄
ntpd-opts.h
(14.57 KB)
📄
ntpd.1ntpdman
(32.03 KB)
📄
ntpd.1ntpdmdoc
(29.07 KB)
📄
ntpd.c
(42.16 KB)
📄
ntpd.html
(49.68 KB)
📄
ntpd.man.in
(32.03 KB)
📄
ntpd.mdoc.in
(29.07 KB)
📄
ntpd.texi
(3.25 KB)
📄
ntpdbase-opts.def
(13.21 KB)
📄
ntpsim.c
(17.11 KB)
📄
ppsapi_timepps.h
(497 B)
📄
psl0.conf
(25 B)
📄
psl1.conf
(25 B)
📄
psl2.conf
(37 B)
📄
rc_cmdlength.c
(800 B)
📄
refclock_acts.c
(22.66 KB)
📄
refclock_arbiter.c
(12.15 KB)
📄
refclock_arc.c
(46.85 KB)
📄
refclock_as2201.c
(11.09 KB)
📄
refclock_atom.c
(6.63 KB)
📄
refclock_bancomm.c
(16.11 KB)
📄
refclock_chronolog.c
(7.61 KB)
📄
refclock_chu.c
(45.28 KB)
📄
refclock_conf.c
(7.25 KB)
📄
refclock_datum.c
(22.3 KB)
📄
refclock_dumbclock.c
(8.42 KB)
📄
refclock_fg.c
(6.89 KB)
📄
refclock_gpsdjson.c
(58 KB)
📄
refclock_gpsvme.c
(7.77 KB)
📄
refclock_heath.c
(12.97 KB)
📄
refclock_hopfpci.c
(5.69 KB)
📄
refclock_hopfser.c
(7.41 KB)
📄
refclock_hpgps.c
(16.38 KB)
📄
refclock_irig.c
(30.05 KB)
📄
refclock_jjy.c
(144.27 KB)
📄
refclock_jupiter.c
(25.66 KB)
📄
refclock_leitch.c
(13.27 KB)
📄
refclock_local.c
(5.72 KB)
📄
refclock_msfees.c
(44.66 KB)
📄
refclock_mx4200.c
(41.72 KB)
📄
refclock_neoclock4x.c
(29.08 KB)
📄
refclock_nmea.c
(50.6 KB)
📄
refclock_oncore.c
(121.54 KB)
📄
refclock_palisade.c
(35.15 KB)
📄
refclock_palisade.h
(6.52 KB)
📄
refclock_parse.c
(160.87 KB)
📄
refclock_pcf.c
(4.79 KB)
📄
refclock_pst.c
(8.09 KB)
📄
refclock_ripencc.c
(118.21 KB)
📄
refclock_shm.c
(16.96 KB)
📄
refclock_tpro.c
(4.69 KB)
📄
refclock_true.c
(25.3 KB)
📄
refclock_tsyncpci.c
(28.35 KB)
📄
refclock_tt560.c
(6.12 KB)
📄
refclock_ulink.c
(15.64 KB)
📄
refclock_wwv.c
(79.32 KB)
📄
refclock_wwvb.c
(15.71 KB)
📄
refclock_zyfer.c
(7.38 KB)
Editing: ntp_prio_q.c
/* ntp_prio_q.c * * This file contains the priority queue implementation used by the * discrete event simulator. * * Written By: Sachin Kamboj * University of Delaware * Newark, DE 19711 * Copyright (c) 2006 */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <ntp_stdlib.h> #include <ntp_prio_q.h> /* Priority Queue * -------------- * Define a priority queue in which the relative priority of the elements * is determined by a function 'get_order' which is supplied to the * priority_queue */ queue *debug_create_priority_queue( q_order_func get_order #ifdef _CRTDBG_MAP_ALLOC , const char * sourcefile , int line_num #endif ) { queue *my_queue; #ifndef _CRTDBG_MAP_ALLOC my_queue = emalloc(sizeof(queue)); #else /* preserve original callsite __FILE__ and __LINE__ for leak report */ my_queue = debug_erealloc(NULL, sizeof(queue), sourcefile, line_num); #endif my_queue->get_order = get_order; my_queue->front = NULL; my_queue->no_of_elements = 0; return my_queue; } /* Define a function to "destroy" a priority queue, freeing-up * all the allocated resources in the process */ void destroy_queue( queue *my_queue ) { node *temp = NULL; /* Empty out the queue elements if they are not already empty */ while (my_queue->front != NULL) { temp = my_queue->front; my_queue->front = my_queue->front->node_next; free(temp); } /* Now free the queue */ free(my_queue); } /* Define a function to allocate memory for one element * of the queue. The allocated memory consists of size * bytes plus the number of bytes needed for bookkeeping */ void *debug_get_node( size_t size #ifdef _CRTDBG_MAP_ALLOC , const char * sourcefile , int line_num #endif ) { node *new_node; #ifndef _CRTDBG_MAP_ALLOC new_node = emalloc(sizeof(*new_node) + size); #else new_node = debug_erealloc(NULL, sizeof(*new_node) + size, sourcefile, line_num); #endif new_node->node_next = NULL; return new_node + 1; } /* Define a function to free the allocated memory for a queue node */ void free_node( void *my_node ) { node *old_node = my_node; free(old_node - 1); } void * next_node( void *pv ) { node *pn; pn = pv; pn--; if (pn->node_next == NULL) return NULL; return pn->node_next + 1; } /* Define a function to check if the queue is empty. */ int empty( queue *my_queue ) { return (!my_queue || !my_queue->front); } void * queue_head( queue *q ) { if (NULL == q || NULL == q->front) return NULL; return q->front + 1; } /* Define a function to add an element to the priority queue. * The element is added according to its priority - * relative priority is given by the get_order function */ queue *enqueue( queue * my_queue, void * my_node ) { node *new_node = (node *)my_node - 1; node *i = NULL; node *j = my_queue->front; while (j != NULL && (*my_queue->get_order)(new_node + 1, j + 1) > 0) { i = j; j = j->node_next; } if (i == NULL) { /* Insert at beginning of the queue */ new_node->node_next = my_queue->front; my_queue->front = new_node; } else { /* Insert Elsewhere, including the end */ new_node->node_next = i->node_next; i->node_next = new_node; } ++my_queue->no_of_elements; return my_queue; } /* Define a function to dequeue the first element from the priority * queue and return it */ void *dequeue( queue *my_queue ) { node *my_node = my_queue->front; if (my_node != NULL) { my_queue->front = my_node->node_next; --my_queue->no_of_elements; return my_node + 1; } else return NULL; } /* Define a function that returns the number of elements in the * priority queue */ int get_no_of_elements( queue *my_queue ) { return my_queue->no_of_elements; } /* Define a function to append a queue onto another. * Note: there is a faster way (O(1) as opposed to O(n)) * to do this for simple (FIFO) queues, but we can't rely on * that for priority queues. (Given the current representation) * * I don't anticipate this to be a problem. If it does turn * out to be a bottleneck, I will consider replacing the * current implementation with a binomial or fibonacci heap. */ void append_queue( queue *q1, queue *q2 ) { while (!empty(q2)) enqueue(q1, dequeue(q2)); destroy_queue(q2); } /* FIFO Queue * ---------- * Use the priority queue to create a traditional FIFO queue. * The only extra function needed is the create_queue */ /* C is not Lisp and does not allow anonymous lambda functions :-(. * So define a get_fifo_order function here */ int get_fifo_order(const void *el1, const void *el2) { return 1; }
Upload File
Create Folder